Skip to content

Commit

Permalink
feat: add githooks conventional commits
Browse files Browse the repository at this point in the history
  • Loading branch information
jiarong committed Nov 28, 2024
1 parent ffc462a commit d96ba67
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

commit_re="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-zA-Z 0-9 \-_]+\))?!?: .+$"
commit_message=$(cat "$1")

if [[ "$commit_message" =~ $commit_re ]]; then
exit 0
fi

echo "The 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 "Details: https://www.conventionalcommits.org/en/v1.0.0/#summary"
exit 1

0 comments on commit d96ba67

Please sign in to comment.