|
26 | 26 | name: Check Commit Message |
27 | 27 | runs-on: ubuntu-latest |
28 | 28 | steps: |
| 29 | + - name: Check overall commit Message |
| 30 | + uses: gsactions/commit-message-checker@v2 |
| 31 | + with: |
| 32 | + excludeDescription: 'true' # optional: this excludes the description body of a pull request |
| 33 | + excludeTitle: 'true' # optional: this excludes the title of a pull request |
| 34 | + checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request |
| 35 | + accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true |
| 36 | + pattern: '^(?![A-Z].*\.)[A-Z].{0,49}(\r?|\r?\n(?:.{0,71}\r?\n)*(?:.{0,71}\.)?\r?\n?)$' |
| 37 | + error: "The commit messages do not follow " |
29 | 38 | - name: Check Subject Line Length |
| 39 | + if: ${{ failure() }} |
30 | 40 | uses: gsactions/commit-message-checker@v2 |
31 | 41 | with: |
32 | 42 | excludeDescription: 'true' # optional: this excludes the description body of a pull request |
|
36 | 46 | pattern: '^.{0,50}(\n.*)*$' |
37 | 47 | error: 'Subject line was too long, exceeding 50 characters. Continue in the body of the commit message' |
38 | 48 | - name: Check Subject Line Capitalization |
39 | | - if: ${{ success() || failure() }} |
| 49 | + if: ${{ failure() }} |
40 | 50 | uses: gsactions/commit-message-checker@v2 |
41 | 51 | with: |
42 | 52 | excludeDescription: 'true' # optional: this excludes the description body of a pull request |
|
46 | 56 | pattern: '^[A-Z]' |
47 | 57 | error: 'Subject line must begin with an imperative verb in present tense and first letter in uppercase' |
48 | 58 | - name: Check Subject Line Ending |
49 | | - if: ${{ success() || failure() }} |
| 59 | + if: ${{ failure() }} |
50 | 60 | uses: gsactions/commit-message-checker@v2 |
51 | 61 | with: |
52 | 62 | excludeDescription: 'true' # optional: this excludes the description body of a pull request |
|
56 | 66 | pattern: '(?<![\.\?\!])$' |
57 | 67 | error: 'Subject line must not end with a period, question mark or exclamation!' |
58 | 68 | - name: Check Body Line Length |
59 | | - if: ${{ success() || failure() }} |
| 69 | + if: ${{ failure() }} |
60 | 70 | uses: gsactions/commit-message-checker@v2 |
61 | 71 | with: |
62 | 72 | excludeDescription: 'true' # optional: this excludes the description body of a pull request |
|
66 | 76 | pattern: '^.+((\n*.{0,72}\n)*)*$' |
67 | 77 | error: 'The body must not exceed 72 characters per line and must have end with a newline character.' |
68 | 78 | - name: Check body ends with an appropriate punctuation (. or ? or !) |
69 | | - if: ${{ success() || failure() }} |
| 79 | + if: ${{ failure() }} |
70 | 80 | uses: gsactions/commit-message-checker@v2 |
71 | 81 | with: |
72 | 82 | excludeDescription: 'true' # optional: this excludes the description body of a pull request |
|
75 | 85 | accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true |
76 | 86 | pattern: '^.+(\n*(.+[\.\!\?])*)*$' |
77 | 87 | error: 'The text of the body must end with a period, question mark or exclamation!' |
78 | | - # Check the full pattern, now that we covered more common mistakes. |
79 | | - - name: Check overall commit Message |
80 | | - if: ${{ success() }} |
81 | | - uses: gsactions/commit-message-checker@v2 |
82 | | - with: |
83 | | - excludeDescription: 'true' # optional: this excludes the description body of a pull request |
84 | | - excludeTitle: 'true' # optional: this excludes the title of a pull request |
85 | | - checkAllCommitMessages: 'true' # optional: this checks all commits associated with a pull request |
86 | | - accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true |
87 | | - pattern: '^(?![A-Z].*\.)[A-Z].{0,49}(\r?|\r?\n(?:.{0,71}\r?\n)*(?:.{0,71}\.)?\r?\n?)$' |
88 | | - error: "The commit messages do not follow " |
0 commit comments