ci: commitlint: ignore boring commits: github merge commit (#1606)

This commit is contained in:
Simon Michael 2021-07-13 11:35:20 -10:00
parent ce526305bf
commit 4d04da94fb

View File

@ -53,19 +53,25 @@ function checkmsg()
SUMMARY=$(echo "$MSG" | head -1)
FMT="%s%-60s %b${NRM}\n"
# Is this some boring commit, eg a hard-to avoid github merge commit ?
# Ignore those.
if echo "$SUMMARY" | grep -qE '^Merge \w{40} into \w{40}'
then
# shellcheck disable=SC2059
printf "$FMT" "$HASH" "$SUMMARY" "[ignored]"
# Does the summary follow convention ?
# [;]type[!]: [topic: [subtopic: ...]] subject
#
# spaces after ; and ! and : are optional (also before, but that should be discouraged)
# the type prefix is required and must be all word characters
# there can be zero or more topic prefixes of increasing depth
# a topic prefix must begin with a word character, can contain spaces/slashes/commas
# (so potentially multiple topic labels, eg "imp: bs, cf, is: cli/doc: blah blah")
if ! echo "$SUMMARY" | grep -qE '^( *; *)?\w+( *!)? *: *(\w[\w,/ ]* *: *)*'
elif ! echo "$SUMMARY" | grep -qE '^( *; *)?\w+( *!)? *: *(\w[\w,/ ]* *: *)*'
then
# shellcheck disable=SC2059
printf "$FMT" "$HASH" "$SUMMARY" "${RED}[FAIL]"
STATUS=1
# Looks like a good commit.
else
# shellcheck disable=SC2059
printf "$FMT" "$HASH" "$SUMMARY" "${GRN}[ok]"