-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (37 loc) · 1.95 KB
/
commit-check-workflow.yml
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
48
49
name: Commit Message Check
run-name: ${{ format('{0} triggered by {1} on {2} {3}', github.workflow, (github.event_name == 'workflow_dispatch' && format('user {0}', github.actor) || format('{0} event', github.event_name) ), github.repository, github.ref_name) }}
on:
pull_request:
jobs:
CheckCommitMessages:
permissions:
contents: read
runs-on: ubuntu-22.04
steps:
- name: Check out PR code
uses: actions/checkout@v4
with:
fetch-depth: ${{github.event.pull_request.commits}} # only checkout commits from this PR
ref: ${{ github.ref }}
- name: Check PR commit messages don't start with 'FIXUP'
run: "[ $(git log --grep '^FIXUP' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with 'SQUASH'
run: "[ $(git log --grep '^SQUASH' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with 'AMEND'
run: "[ $(git log --grep '^AMEND' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with 'REWORD'
run: "[ $(git log --grep '^REWORD' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with 'DONOTMERGE'
run: "[ $(git log --grep '^DONOTMERGE' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with 'WIP'
run: "[ $(git log --grep '^WIP' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with 'TEMP'
run: "[ $(git log --grep '^TEMP' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with '!fixup'
run: "[ $(git log --grep '^!fixup' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with '!squash'
run: "[ $(git log --grep '^!squash' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with '!amend'
run: "[ $(git log --grep '^!amend' | wc -c) -eq 0 ]"
- name: Check PR commit messages don't start with '!reword'
run: "[ $(git log --grep '^!reword' | wc -c) -eq 0 ]"