|
| 1 | +# Check that the commit messages are between 20 and 150 chars, |
| 2 | +# and that they follow the rule |
| 3 | +# <type> (<scope>): <subject> |
| 4 | +# type: docs, feat, fix, refactor, style or test |
| 5 | +# scope (optional): any extra info, (like DMS or whatever) |
| 6 | + |
| 7 | +name: "Commit Message Check" |
| 8 | +on: pull_request |
| 9 | + |
| 10 | +jobs: |
| 11 | + check-commit-message: |
| 12 | + name: Check Commit Message |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Check Commit Format |
| 16 | + uses: gsactions/commit-message-checker@v1 |
| 17 | + with: |
| 18 | + pattern: '^(docs|feat|fix|refactor|style|test|sweep)( ?\(.*\))?: .+$' |
| 19 | + excludeDescription: "true" # optional: this excludes the description body of a pull request |
| 20 | + excludeTitle: "true" # optional: this excludes the title of a pull request |
| 21 | + checkAllCommitMessages: "true" # optional: this checks all commits associated with a pull request |
| 22 | + accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true |
| 23 | + flags: "gim" |
| 24 | + error: 'Your commit has to follow the format "<type>(<scope>): <subject>"".' |
| 25 | + - name: Check Commit Length |
| 26 | + uses: gsactions/commit-message-checker@v1 |
| 27 | + with: |
| 28 | + pattern: "^.{20,150}$" |
| 29 | + error: "Commit messages should be between 20 and 150 chars" |
| 30 | + excludeDescription: "true" # optional: this excludes the description body of a pull request |
| 31 | + excludeTitle: "true" # optional: this excludes the title of a pull request |
| 32 | + checkAllCommitMessages: "true" # optional: this checks all commits associated with a pull request |
| 33 | + accessToken: ${{ secrets.GITHUB_TOKEN }} # github access token is only required if checkAllCommitMessages is true |
0 commit comments