Skip to content

Commit 7be9c75

Browse files
committed
[TASK] Add a github action to test the commit message
1 parent 9bc43cf commit 7be9c75

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 'Commit Message Check'
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- edited
7+
- reopened
8+
- synchronize
9+
pull_request_target:
10+
types:
11+
- opened
12+
- edited
13+
- reopened
14+
- synchronize
15+
push:
16+
branches:
17+
- main
18+
- 'releases/*'
19+
20+
jobs:
21+
check-commit-message:
22+
name: Check Commit Message
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Check Commit Type
26+
uses: gsactions/commit-message-checker@v1
27+
with:
28+
pattern: '\[[^]]+\] .+$'
29+
flags: 'gm'
30+
error: 'Your first line has to contain a commit type like "[BUGFIX]".'
31+
excludeTitle: 'true' # optional: this excludes the title of a pull request
32+
33+
- name: Check Line Length
34+
uses: gsactions/commit-message-checker@v1
35+
with:
36+
pattern: '^[^#].{74}'
37+
error: 'The maximum line length of 74 characters is exceeded.'
38+
excludeDescription: 'false' # optional: this excludes the description body of a pull request
39+
excludeTitle: 'true' # optional: this excludes the title of a pull request
40+
checkAllCommitMessages: 'false' # optional: this checks all commits associated with a pull request
41+
#accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true

0 commit comments

Comments
 (0)