Skip to content

Commit 36b0c57

Browse files
committed
chore: Add commit message linter
1 parent 52fcc0e commit 36b0c57

File tree

6 files changed

+1116
-0
lines changed

6 files changed

+1116
-0
lines changed

.github/workflows/commitlint.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Lint Commit Messages
2+
on: [pull_request]
3+
4+
jobs:
5+
commitlint:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
with:
10+
fetch-depth: 0
11+
- uses: wagoid/commitlint-github-action@v5

.husky/commit-msg

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
if git-branch-is main; then
5+
npx --no -- commitlint --edit
6+
fi

CONTRIBUTING.md

+28
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,31 @@ To get up and running, follow these steps:
1515
6. Test search manually: `npm run serve`
1616

1717
You can view debug information at http://localhost:3000/\_\_docusaurus/debug (generated by [@docusaurus/plugin-debug](https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-debug))
18+
19+
## Commit Message Guidelines
20+
21+
Commit messages for this repository should follow the "Conventional Commits" specification.
22+
Each message must start with one of the following keywords:
23+
24+
```
25+
build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test
26+
```
27+
28+
Include a brief description after the keyword, starting with a capital letter and no ending period. For example:
29+
30+
```
31+
fix: Add German translation
32+
feat: Add better search integration
33+
chore: Update dependencies
34+
docs: Added more detailed documentation
35+
```
36+
37+
Please use `feat` for new features, `fix` for bug fixes, or one of the other keywords when appropriate.
38+
39+
To mark breaking changes, include a `!` after the keyword. For example:
40+
41+
```
42+
chore!: Require Node.js v16
43+
```
44+
45+
By following these guidelines, we can ensure that our commit messages are clear and consistent, which makes it easier to automatically generate changelogs.

commitlint.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
extends: ["@commitlint/config-conventional"],
3+
rules: {
4+
"subject-case": [2, "always", "sentence-case"],
5+
},
6+
helpUrl:
7+
"https://github.com/cmfcmf/docusaurus-search-local/blob/main/CONTRIBUTING.md#commit-message-guidelines",
8+
};

0 commit comments

Comments
 (0)