Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down