Created
June 22, 2022 16:18
-
-
Save zhangr4/58ee880ed5834359ddddd9003e6d7d2e to your computer and use it in GitHub Desktop.
hooks: check commit message match convention
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
#!/usr/bin/env bash | |
REGEX_COMMIT_MSG='^(feat|fix|docs|style|refactor|perf|test|workflow|build|ci|chore|release|workflow)(\(.+\))?: .{1,50}'; | |
# https://www.conventiona | |
if [[ $(<"$1") =~ $REGEX_COMMIT_MSG ]] | |
then | |
echo "commit message match convention"; | |
exit 0; | |
fi | |
echo "commit message not match convention" | |
exit 1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment