Skip to content

Instantly share code, notes, and snippets.

@zhangr4
Created June 22, 2022 16:18
Show Gist options
  • Save zhangr4/58ee880ed5834359ddddd9003e6d7d2e to your computer and use it in GitHub Desktop.
Save zhangr4/58ee880ed5834359ddddd9003e6d7d2e to your computer and use it in GitHub Desktop.
hooks: check commit message match convention
#!/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