From 4d04da94fb6df06acb6028e8da59f73226c8abdf Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 13 Jul 2021 11:35:20 -1000 Subject: [PATCH] ci: commitlint: ignore boring commits: github merge commit (#1606) --- bin/commitlint | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/commitlint b/bin/commitlint index cd4a096a5..2c5fe4cd4 100755 --- a/bin/commitlint +++ b/bin/commitlint @@ -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]"