-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (43 loc) · 1.37 KB
/
commit_messages.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
37
38
39
40
41
42
43
44
45
46
47
---
# yamllint disable rule:quoted-strings
name: Commit Message Check
"on": pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
preflight:
runs-on: ubuntu-latest
outputs:
renovate: ${{ steps.renovate.outputs.renovate }}
steps:
# flag PRs opened by renovate
- id: renovate
run: |
if [[ ${{ github.head_ref }} == *"renovate"* ]]; then
echo "renovate=true" >> $GITHUB_OUTPUT
else
echo "renovate=false" >> $GITHUB_OUTPUT
fi
check-commit-message:
name: Check Commit Message
needs: [preflight]
# ignore PRs from renovate
if: ${{ needs.preflight.outputs.renovate == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Check Commit Type
uses: gsactions/commit-message-checker@v2
with:
pattern: '\([^)]+\) .+$'
flags: gm
error: Your first line has to contain a commit type like '(role/foo)'.
checkAllCommitMessages: "true"
accessToken: "${{ secrets.GITHUB_TOKEN }}"
- name: Check Line Length
uses: gsactions/commit-message-checker@v2
with:
pattern: '^(?!.{73})'
error: The maximum line length of 72 characters is exceeded.
checkAllCommitMessages: "true"
accessToken: "${{ secrets.GITHUB_TOKEN }}"