Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(git): enabled pre-commit hook enforcing conventional commits
- Loading branch information
1 parent
41ccc5f
commit a56fce8
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
RED="\033[1;31m" | ||
GREEN="\033[1;32m" | ||
|
||
# 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-z \-]+\))?!?: .+$") then | ||
echo "${GREEN} ✔ Commit message meets Conventional Commit standards" | ||
exit 0 | ||
fi | ||
|
||
echo "${RED}❌ Commit message does not meet the Conventional Commit standard!" | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters