|
1 |
| -# GS Commit Message Checker |
| 1 | +# Commit Messages(in Pull Reqeust) Checker with regex |
2 | 2 |
|
3 | 3 | 
|
4 | 4 | 
|
|
32 | 32 | - edited
|
33 | 33 | - reopened
|
34 | 34 | - synchronize
|
35 |
| - push: |
36 |
| - branches: |
37 |
| - - master |
38 |
| - - 'releases/*' |
39 | 35 |
|
40 | 36 | jobs:
|
41 | 37 | check-commit-message:
|
42 | 38 | name: Check Commit Message
|
43 | 39 | runs-on: ubuntu-latest
|
44 | 40 | steps:
|
45 |
| - - name: Check Commit Type |
46 |
| - uses: gsactions/commit-message-checker@v1 |
| 41 | + - name: Get PR Commits |
| 42 | + id: 'get-pr-commits' |
| 43 | + uses: tim-actions/get-pr-commits@master |
47 | 44 | with:
|
48 |
| - pattern: '\[[^]]+\] .+$' |
49 |
| - flags: 'gm' |
50 |
| - error: 'Your first line has to contain a commit type like "[BUGFIX]".' |
51 |
| - - name: Check Line Length |
52 |
| - uses: gsactions/commit-message-checker@v1 |
| 45 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Check Subject Line Length |
| 48 | + uses: tim-actions/[email protected] |
| 49 | + with: |
| 50 | + commits: ${{ steps.get-pr-commits.outputs.commits }} |
| 51 | + pattern: '^.{0,75}(\n.*)*$' |
| 52 | + error: 'Subject too long (max 75)' |
| 53 | + |
| 54 | + - name: Check Body Line Length |
| 55 | + if: ${{ success() || failure() }} |
| 56 | + uses: tim-actions/[email protected] |
| 57 | + with: |
| 58 | + commits: ${{ steps.get-pr-commits.outputs.commits }} |
| 59 | + pattern: '^.+(\n.{0,72})*$' |
| 60 | + error: 'Body line too long (max 72)' |
| 61 | + |
| 62 | + - name: Check Fixes |
| 63 | + if: ${{ success() || failure() }} |
| 64 | + uses: tim-actions/[email protected] |
53 | 65 | with:
|
54 |
| - pattern: '^[^#].{74}' |
55 |
| - error: 'The maximum line length of 74 characters is exceeded.' |
56 |
| - - name: Check for Resolves / Fixes |
57 |
| - uses: gsactions/commit-message-checker@v1 |
| 66 | + commits: ${{ steps.get-pr-commits.outputs.commits }} |
| 67 | + pattern: '\s*Fixes\s*:?\s*(#\d+|github\.com\/kata-containers\/[a-z-.]*#\d+)' |
| 68 | + error: 'No "Fixes" found' |
| 69 | + |
| 70 | + - name: Check subsystem |
| 71 | + if: ${{ success() || failure() }} |
| 72 | + uses: tim-actions/[email protected] |
58 | 73 | with:
|
59 |
| - pattern: '^.+(Resolves|Fixes): \#[0-9]+$' |
60 |
| - error: 'You need at least one "Resolves|Fixes: #<issue number>" line.' |
| 74 | + commits: ${{ steps.get-pr-commits.outputs.commits }} |
| 75 | + pattern: '^[\h]*([^:\h]+)[\h]*:' |
| 76 | + error: 'Failed to find subsystem in subject' |
| 77 | + |
| 78 | + |
61 | 79 | ```
|
62 | 80 |
|
63 | 81 | ## Development
|
|
0 commit comments