File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,20 +59,23 @@ check_commitlint () {
5959 commit_hash=$( echo " $line " | cut -d ' ' -f 1)
6060 commit_title=$( echo " $line " | cut -d ' ' -f 2-)
6161 commit_number_of_parents=$( git rev-list --parents " $commit_hash " -n1 | awk ' {print NF-1}' )
62+ # (i) skip checking release commits generated by Release Please
63+ if [ " $commit_number_of_parents " -le 1 ] && echo " $commit_title " | grep -qP " ^chore\(.*\): release" ; then
64+ continue
65+ fi
66+ # (ii) check presence of PR number
67+ if ! echo " $commit_title " | grep -qP " \(\#$pr \)$" ; then
68+ echo " ✖ Headline does not end by '(#$pr )' PR number: $commit_title "
69+ found=1
70+ fi
71+ # (iii) check absence of merge commits in feature branches
6272 if [ " $commit_number_of_parents " -gt 1 ]; then
6373 if echo " $commit_title " | grep -qP " ^chore\(.*\): merge " ; then
64- break
74+ break # skip checking maint-to-master merge commits
6575 else
6676 echo " ✖ Merge commits are not allowed in feature branches: $commit_title "
6777 found=1
6878 fi
69- elif echo " $commit_title " | grep -qP " ^chore\(.*\): release" ; then
70- true
71- elif echo " $commit_title " | grep -qP " \(\#$pr \)$" ; then
72- true
73- else
74- echo " ✖ Headline does not end by '(#$pr )' PR number: $commit_title "
75- found=1
7679 fi
7780 done < <( git log " $from ..$to " --format=" %H %s" )
7881 if [ $found -gt 0 ]; then
You can’t perform that action at this time.
0 commit comments