Skip to content

Commit af8c32b

Browse files
committed
ci(commitlint): fix local running of commit linter on macOS (#427)
Replaces GNU-specific `grep` command-line option in the commitlint check so that the linter would work locally on both macOS and Linux operating systems.
1 parent adee81c commit af8c32b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

run-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ check_commitlint () {
2020
commit_title=$(echo "$line" | cut -d ' ' -f 2-)
2121
commit_number_of_parents=$(git rev-list --parents "$commit_hash" -n1 | awk '{print NF-1}')
2222
# (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
23+
if [ "$commit_number_of_parents" -le 1 ] && echo "$commit_title" | grep -qE "^chore\(.*\): release"; then
2424
continue
2525
fi
2626
# (ii) check presence of PR number
27-
if ! echo "$commit_title" | grep -qP "\(\#$pr\)$"; then
27+
if ! echo "$commit_title" | grep -qE "\(#$pr\)$"; then
2828
echo "✖ Headline does not end by '(#$pr)' PR number: $commit_title"
2929
found=1
3030
fi
3131
# (iii) check absence of merge commits in feature branches
3232
if [ "$commit_number_of_parents" -gt 1 ]; then
33-
if echo "$commit_title" | grep -qP "^chore\(.*\): merge "; then
33+
if echo "$commit_title" | grep -qE "^chore\(.*\): merge "; then
3434
break # skip checking maint-to-master merge commits
3535
else
3636
echo "✖ Merge commits are not allowed in feature branches: $commit_title"

0 commit comments

Comments
 (0)