From ff52a23b642144ca1e9f5189bbefeb7d32a5398f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6lfer?= Date: Sun, 18 Jan 2026 00:18:10 +0100 Subject: [PATCH] chore: Add conventional commit checker --- .scripts/commit-msg | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .scripts/commit-msg diff --git a/.scripts/commit-msg b/.scripts/commit-msg new file mode 100644 index 0000000..5973667 --- /dev/null +++ b/.scripts/commit-msg @@ -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 +