Skip to content

Commit c7dcf40

Browse files
committed
chore(pre-commit): switch from commitlint to gitlint
Mostly to move towards not having a dependency on nodejs.
1 parent ae1a164 commit c7dcf40

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

.commitlintrc.yaml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ jobs:
5151
jq '[.[] | {id: .sha, message: .commit.message}]' >"$commits_json"
5252
fi
5353
54+
git config user.name $(git log -1 --format=format:%an)
55+
git config user.email $(git log -1 --format=format:%ae)
5456
rc=0
5557
for id in $(jq --raw-output '.[].id' <"$commits_json"); do
5658
jq --raw-output ".[] | select(.id==\"$id\") | .message" \
5759
<"$commits_json" >"$commit_txt"
5860
echo "Linting commit $id message..."
5961
set +e
60-
pre-commit run commitlint \
62+
pre-commit run gitlint \
6163
--color=always \
6264
--hook-stage=commit-msg \
6365
--commit-msg-filename="$commit_txt"

.gitlint

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[general]
2+
ignore = body-is-missing
3+
ignore-fixup-commits = false
4+
ignore-revert-commits = false
5+
ignore-squash-commits = false
6+
ignore-stdin = true
7+
contrib = contrib-title-conventional-commits
8+
9+
[ignore-body-lines]
10+
regex = ^(Co-authored-by:|(Refs )?https?://)

.pre-commit-config.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
repos:
22

3-
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
4-
rev: v5.0.0
3+
- repo: https://github.com/jorisroovers/gitlint
4+
rev: v0.15.1
55
hooks:
6-
- id: commitlint
7-
additional_dependencies: ["@commitlint/config-conventional@12.1.4"]
6+
- id: gitlint
87
stages: [commit-msg]
98

109
- repo: local

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ Also, please bear the following coding guidelines in mind:
156156
- We use [Conventional Commits](https://www.conventionalcommits.org/)
157157
to format commit messages, with types and most other details from
158158
[commitlint's config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional).
159+
`gitlint` in our pre-commit config checks commit messages for
160+
conformance with these rules.
159161

160162
It is important to do this correctly; commit types `fix` and `feat`
161163
as well as any change marked as breaking affects what ends up in the

0 commit comments

Comments
 (0)