mirror of
https://github.com/carp-lang/Carp.git
synced 2024-11-04 01:25:04 +03:00
chore: Makes the commit message hooks more portable (#1042)
Ditches awk and uses sed instead
This commit is contained in:
parent
0bd5fa4cb6
commit
f89a3f130e
@ -3,8 +3,8 @@ set -euo noglob
|
||||
|
||||
VALID_TYPES="build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test"
|
||||
COMMIT_MESSAGE=$(cat "$1")
|
||||
OUTPUT=$(echo "$COMMIT_MESSAGE" | awk "/^($VALID_TYPES)(\(.*\))?(!|)?: .*/");
|
||||
if [ ${#OUTPUT} -gt 0 ]; then
|
||||
OUTPUT=$(echo "$COMMIT_MESSAGE" | sed -n 1p | sed -E "s/^($VALID_TYPES)(\(.*\))?(\!|\\\!)?: .*//");
|
||||
if [ ${#OUTPUT} -eq 0 ] && [ ${#COMMIT_MESSAGE} -ne 0 ]; then
|
||||
exit 0;
|
||||
else
|
||||
echo "Commit message does not follow Conventional Commits."
|
||||
@ -15,3 +15,4 @@ else
|
||||
echo "For more information see https://www.conventionalcommits.org"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user