sigit.io/.git-hooks/commit-msg
enes 950593aeed
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 33s
chore(git-hooks): clean commit-msg script
2024-08-12 16:01:56 +02:00

19 lines
684 B
Bash
Executable File

#!/bin/sh
# Get the commit message (the parameter we're given is just the path to the
# temporary file which holds the message).
commit_message=$(cat "$1")
if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z0-9 \-]+\))?!?: .+$") then
tput setaf 2;
echo "✔ Commit message meets Conventional Commit standards"
tput sgr0;
exit 0
fi
tput setaf 1;
echo "❌ Commit message does not meet the Conventional Commit standard!"
tput sgr0;
echo "An example of a valid message is:"
echo " feat(login): add the 'remember me' button"
echo "📝 More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
exit 1