chore: Add conventional commit checker #2

Merged
lukas merged 1 commits from commit-msg-hook into main 2026-01-18 00:21:02 +01:00
Showing only changes of commit ff52a23b64 - Show all commits

19
.scripts/commit-msg Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
# Path to the commit message file
COMMIT_MSG_FILE=$1
# Read the commit message
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
# Regex pattern for Conventional Commits
# Example: "feat: add new feature" or "fix!: break everything"
PATTERN='^(feat|fix|docs|style|refactor|perf|test|chore|revert|build|ci|wip|workflow)([!]?): .{1,}$'
if ! echo "$COMMIT_MSG" | grep -Eq "$PATTERN"; then
echo "❌ Invalid commit message format."
echo "Please follow the Conventional Commits specification: https://www.conventionalcommits.org/"
echo "Example: 'feat: add new feature'"
exit 1
fi