From b7efd4edc09897f728ea44d4848f8391bde4ab69 Mon Sep 17 00:00:00 2001 From: FabLrc Date: Sat, 28 Feb 2026 13:38:35 +0100 Subject: [PATCH] fix: allow merge commits in conventional commits validation --- .githooks/commit-msg | 6 ++++++ .github/workflows/ci.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 58191be..7d3a2fa 100644 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -9,6 +9,12 @@ # Types allowed: feat, fix, docs, style, refactor, test, chore, ci, build, perf, revert subject=$(head -1 "$1") + +# Allow system merge commits (GitHub, Git merges) +if echo "$subject" | grep -qE "^(Merge|Squashed|Revert)"; then + exit 0 +fi + pattern='^(feat|fix|docs|style|refactor|test|chore|ci|build|perf|revert)(\(.+\))?!?: .+' if ! echo "$subject" | grep -qE "$pattern"; then diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0b47e7..400671c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,11 @@ jobs: while IFS= read -r msg; do subject=$(echo "$msg" | head -1) + # Allow system merge commits + if echo "$subject" | grep -qE "^(Merge|Squashed|Revert)"; then + echo "✅ \"$subject\" (merge)" + continue + fi if ! echo "$subject" | grep -qE "$pattern"; then echo "❌ \"$subject\"" failed=1 @@ -40,6 +45,7 @@ jobs: echo "Un ou plusieurs commits ne respectent pas Conventional Commits." echo "Format attendu : type(scope)?: sujet" echo "Types autorisés : feat | fix | docs | style | refactor | test | chore | ci | build | perf | revert" + echo "(Les commits de merge Merge/Squashed/Revert sont toujours acceptés)" exit 1 fi