-
Notifications
You must be signed in to change notification settings - Fork 20
36 lines (35 loc) · 1.8 KB
/
commit_checker.yaml
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
name: 'Commit Message Check'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
push:
branches:
- main
jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
steps:
- name: Check Commit Format
uses: gsactions/commit-message-checker@v2
with:
pattern: '^(feat|fix|chore|refactor|test|ci|build|([A-Z]+-[0-9]+))(\(\w+\))?(:| -) .+'
flags: 'gim'
error: 'Commit message should start with a jira key or any keyword feat/fix/chore/refactor/test/ci/build. Example: "RHINENG-1234: xxx", "chore: xxx"'
excludeDescription: 'true' # optional: this excludes the description body of a pull request
# excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true
- name: Check Commit Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^.{10,70}(\n(\n.{0,100})*)?$'
error: 'The maximum line length be exceeded. Requires the first line to contain 10-70 characters and, if the message continues, the second line must be empty and the following lines 0-100 characters long.'
excludeDescription: 'true' # optional: this excludes the description body of a pull request
# excludeTitle: 'true' # optional: this excludes the title of a pull request
checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request
accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true