add git hooks for commit validation, auto-suggestions, and Docker build/push automation on git push

This commit is contained in:
Egor Pozharov
2026-04-21 12:54:39 +06:00
parent bf62714d0d
commit 60dea22ced
5 changed files with 136 additions and 4 deletions

27
.githooks/commit-msg Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Commit message hook: validate commit message format
COMMIT_MSG_FILE=$1
MSG=$(head -n1 "$COMMIT_MSG_FILE")
# Skip validation for merge commits
if echo "$MSG" | grep -q "^Merge"; then
exit 0
fi
# Check message length
if [ ${#MSG} -lt 5 ]; then
echo "❌ Commit message too short (min 5 characters)"
exit 1
fi
# Optional: enforce conventional commits format
# Uncomment if you want to enforce prefixes like "feat:", "fix:", etc.
# if ! echo "$MSG" | grep -qE "^(feat|fix|docs|style|refactor|test|chore|backend|frontend|deploy)(\(.+\))?:"; then
# echo "❌ Commit message should follow format: type: description"
# echo " Allowed types: feat, fix, docs, style, refactor, test, chore, backend, frontend, deploy"
# exit 1
# fi
echo "✅ Commit message OK"
exit 0