Skip to content

Commit 72da9dd

Browse files
feat: add commit-msg hook to enforce Conventional Commits format
1 parent 570afde commit 72da9dd

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

scripts/git-hooks/commit-msg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
# Validates conventional commits format (install: git config core.hooksPath scripts/git-hooks).
3+
pattern="^(feat|fix|docs|refactor|perf|test|chore|style)(\(.+\))?: .{1,100}"
4+
if ! grep -qE "$pattern" "$1"; then
5+
echo "ERROR: Commit message does not follow Conventional Commits format."
6+
echo "Please see CONTRIBUTING.md for accepted formats."
7+
exit 1
8+
fi

0 commit comments

Comments
 (0)