style: added automatic hooks

This commit is contained in:
2584433
2025-10-06 08:00:59 +00:00
committed by Kasper Marinus
parent 83e9f28573
commit 42e4d10c80
5 changed files with 54 additions and 1 deletions

17
.githooks/commit-msg Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
commit_msg_file=$1
commit_msg=$(cat "$commit_msg_file")
if echo "$commit_msg" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert): .+"; then
if echo "$commit_msg" | grep -Eq "^(ref|close):\sN25B-.+"; then
echo "🎉 commit message is Valid"
exit 0
else
echo "❌ Commit message invalid! Must end with [ref/close]: N25B-000"
exit 1
fi
else
echo "❌ Commit message invalid! Must start with <type>: <description>"
exit 1
fi