Commit c066472 1 parent 1561a4b commit c066472 Copy full SHA for c066472
File tree 3 files changed +22
-9
lines changed
3 files changed +22
-9
lines changed Original file line number Diff line number Diff line change 1
1
rules :
2
2
body-case : [2, always, sentence-case]
3
- body-full-stop : [2 , always]
3
+ body-full-stop : [1 , always]
4
4
body-leading-blank : [2, always]
5
5
body-max-line-length : [2, always, 72]
6
6
footer-leading-blank : [2, always]
Original file line number Diff line number Diff line change 33
33
- name : Check commit message compliance of the pull request
34
34
if : github.event_name == 'pull_request'
35
35
run : |
36
- ./run-tests.sh --check-commitlint ${{ github.event.pull_request.head .sha }}~${{ github.event.pull_request.commits }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}
36
+ ./run-tests.sh --check-commitlint ${{ github.event.pull_request.base .sha }} ${{ github.event.pull_request.head.sha }} ${{ github.event.pull_request.number }}
37
37
38
38
lint-shellcheck :
39
39
runs-on : ubuntu-24.04
Original file line number Diff line number Diff line change @@ -16,15 +16,28 @@ check_commitlint () {
16
16
npx commitlint --from=" $from " --to=" $to "
17
17
found=0
18
18
while IFS= read -r line; do
19
- if echo " $line " | grep -qP " \(\#$pr \)$" ; then
20
- true
21
- elif echo " $line " | grep -qP " ^chore\(.*\): release" ; then
22
- true
23
- else
24
- echo " ✖ Headline does not end by '(#$pr )' PR number: $line "
19
+ commit_hash=$( echo " $line " | cut -d ' ' -f 1)
20
+ commit_title=$( echo " $line " | cut -d ' ' -f 2-)
21
+ commit_number_of_parents=$( git rev-list --parents " $commit_hash " -n1 | awk ' {print NF-1}' )
22
+ # (i) skip checking release commits generated by Release Please
23
+ if [ " $commit_number_of_parents " -le 1 ] && echo " $commit_title " | grep -qP " ^chore\(.*\): release" ; then
24
+ continue
25
+ fi
26
+ # (ii) check presence of PR number
27
+ if ! echo " $commit_title " | grep -qP " \(\#$pr \)$" ; then
28
+ echo " ✖ Headline does not end by '(#$pr )' PR number: $commit_title "
25
29
found=1
26
30
fi
27
- done < <( git log " $from ..$to " --format=" %s" )
31
+ # (iii) check absence of merge commits in feature branches
32
+ if [ " $commit_number_of_parents " -gt 1 ]; then
33
+ if echo " $commit_title " | grep -qP " ^chore\(.*\): merge " ; then
34
+ break # skip checking maint-to-master merge commits
35
+ else
36
+ echo " ✖ Merge commits are not allowed in feature branches: $commit_title "
37
+ found=1
38
+ fi
39
+ fi
40
+ done < <( git log " $from ..$to " --format=" %H %s" )
28
41
if [ $found -gt 0 ]; then
29
42
exit 1
30
43
fi
You can’t perform that action at this time.
0 commit comments