Skip to content

Instantly share code, notes, and snippets.

View zhangr4's full-sized avatar

zhangr4 zhangr4

View GitHub Profile
@zhangr4
zhangr4 / commit-msg.sample
Created June 22, 2022 16:18
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