File tree 3 files changed +47
-3
lines changed
3 files changed +47
-3
lines changed Original file line number Diff line number Diff line change 5
5
pull_request :
6
6
7
7
jobs :
8
+ check-commits :
9
+ runs-on : ubuntu-latest
10
+ if : github.event_name == 'pull_request'
11
+ steps :
12
+ - uses : actions/checkout@v2
13
+ with :
14
+ # Fetch all history
15
+ fetch-depth : 0
16
+
17
+ - name : Check commit messages
18
+ run : |
19
+ scripts/check-commits.sh ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
20
+
8
21
shellcheck :
9
22
runs-on : ubuntu-latest
10
23
steps :
11
24
- uses : actions/checkout@v2
12
25
13
26
- name : Shellcheck
14
27
run : |
15
- shellcheck install/*.sh
28
+ shellcheck install/*.sh scripts/*.sh
16
29
17
30
lint :
18
31
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -52,7 +52,6 @@ You should follow the examples below as a guideline for how to name your branche
52
52
```
53
53
feature/brief-description-here
54
54
fix/bug-description
55
- style/some-frontend-component
56
55
refactor/some-component
57
- add/contributing-md
56
+ docs/some-component
58
57
```
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -eo pipefail
4
+
5
+ do_check () {
6
+ set -eo pipefail
7
+
8
+ base=" $1 "
9
+ head=" $2 "
10
+ log=" $( git log --pretty=' format:%h %s' --no-merges " ${base} ..${head} " ) "
11
+ if [ -z " $log " ]; then
12
+ echo ' WARNING: no commits in specified range' >&2
13
+ fi
14
+ grep -vE ' ^[0-9a-f]+ (feat|fix|refactor|docs|chore|build|test|ci|style)(\([a-zA-Z-]+\))?:' <<< " $log" || true
15
+ }
16
+
17
+ if [ $# -ne 2 ]; then
18
+ cat >&2 << EOF
19
+ Usage:
20
+ $0 BASE HEAD
21
+ EOF
22
+ exit 1
23
+ fi
24
+
25
+ output=" $( do_check " $1 " " $2 " ) "
26
+ if [ -n " $output " ]; then
27
+ echo ' Bad commit messages:'
28
+ echo " $output "
29
+ exit 1
30
+ else
31
+ echo ' All commit messages OK'
32
+ fi
You can’t perform that action at this time.
0 commit comments