-
-
Notifications
You must be signed in to change notification settings - Fork 140
79 lines (72 loc) · 2.8 KB
/
commit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: 'Commit Message Check'
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [assigned, opened, synchronize, reopened, edited, ready_for_review]
jobs:
check-commit-message:
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' && github.event.pull_request.draft == false }}
name: Check Commit Message
runs-on: ubuntu-20.04
steps:
- name: Check Commit Type
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[\(\)\-a-z0-9,\s]+!?: .+(?:\n(?:\n.+)+)?(?:\n\n.+)?$'
error: 'Your message must have the correct format "<scope>: <subject>" with an optional body and footer separated by blank lines.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check Title Capitalize
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[^A-Z]'
flags: ''
error: 'Your title should not capitalize first word.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check Title Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[^\s]+([ \t]+[^\s]+){2,}[ \t]*(\n.*)?$'
flags: 's'
error: 'A meaningful title should contain at least 3 words.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check Title Line Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^([^\n]{1,80}|Merge pull request.*)(\n.*)?$'
flags: 's'
error: 'The maximum title line length of 80 characters is exceeded.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check Title Line Separator
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[^\n]+(\n\n.+)?$'
flags: 's'
error: 'Should leave an empty line after title.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Check Line Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^[^\n]+(\n[^\n]{0,80})*$'
flags: 's'
error: 'The maximum line length of 80 characters is exceeded.'
excludeDescription: 'true'
excludeTitle: 'true'
checkAllCommitMessages: 'true'
accessToken: ${{ secrets.GITHUB_TOKEN }}