Skip to content

Commit 0d0beac

Browse files
ci: Add automatic check for commit message format
- Added GitHub Actions workflow to lint commit messages on push and pull request events. - Created custom commitlint configuration file (.commitlintrc.json) to enforce commit message standards. Signed-off-by: Shamitha Shashidhara <[email protected]>
1 parent b90c307 commit 0d0beac

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.commitlintrc.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"rules": {
3+
"type-enum": [2, "always", [
4+
"build",
5+
"chore",
6+
"ci",
7+
"docs",
8+
"feat",
9+
"fix",
10+
"perf",
11+
"refactor",
12+
"revert",
13+
"style",
14+
"test"
15+
]],
16+
"header-full-stop": [2, "never"],
17+
"header-trim": [2, "always"],
18+
"subject-empty": [2, "never"],
19+
"subject-full-stop": [2, "never", "."],
20+
"subject-max-length": [2, "always", 50],
21+
"subject-case": [2, "always", "sentence-case"],
22+
"subject-exclamation-mark": [2, "never"],
23+
"body-leading-blank": [2, "always"],
24+
"body-max-line-length": [2, "always", 72],
25+
"body-case": [2, "always", "sentence-case"],
26+
"signed-off-by": [2, "always", "Signed-off-by:"],
27+
"footer-leading-blank": [2, "always"]
28+
},
29+
"prompt": {
30+
"questions": {
31+
"header": {
32+
"description": "Write a short, imperative tense description of the change"
33+
},
34+
"body": {
35+
"description": "Provide a longer description of the change (optional)"
36+
},
37+
"footer": {
38+
"description": "Ensure the footer includes a Signed-off-by line"
39+
}
40+
}
41+
}
42+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Check Commit Message Format
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
commitmessage:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Commit message format
14+
uses: wagoid/commitlint-github-action@v5
15+
with:
16+
configFile: .commitlintrc.json

0 commit comments

Comments
 (0)