fix(ci): check only commit title for skip patterns (#46)

* fix(ci): check only commit title for skip patterns

The workflow was incorrectly checking the entire commit body for [skip ci]
patterns, causing false positives when the body mentioned these patterns
in documentation.

Fixed by:
- Check only commit title (first line) for skip patterns
- Use git log --pretty=%s instead of %B for skip detection
- Still use full body for version bump type detection

This prevents false positives while maintaining loop prevention.

* chore: trigger CI checks
This commit is contained in:
Darren Hinde 2025-12-09 13:57:50 +00:00 committed by GitHub
parent 7cd5af13dc
commit 2a92388772
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,15 +68,20 @@ jobs:
exit 0 exit 0
fi fi
COMMIT_MSG=$(git log -1 --pretty=%B) # Check commit title (first line only) for skip patterns
COMMIT_TITLE=$(git log -1 --pretty=%s)
# Skip if this is an automated commit to prevent loops # Skip if this is an automated commit to prevent loops
if echo "$COMMIT_MSG" | grep -qE "\[skip ci\]|chore: bump version|docs: sync|chore: version and docs sync"; then # Only check the title, not the full body to avoid false positives
if echo "$COMMIT_TITLE" | grep -qE "\[skip ci\]|chore: bump version|docs: sync|chore: version and docs sync"; then
echo "should_sync=false" >> $GITHUB_OUTPUT echo "should_sync=false" >> $GITHUB_OUTPUT
echo "Automated commit detected - skipping to prevent loops" echo "Automated commit detected in title - skipping to prevent loops"
exit 0 exit 0
fi fi
# Get full commit message for version bump type detection
COMMIT_MSG=$(git log -1 --pretty=%B)
# Determine version bump type from commit message # Determine version bump type from commit message
if echo "$COMMIT_MSG" | grep -qiE "^(feat|feature)\(.*\)!:|^BREAKING CHANGE:|^[a-z]+!:"; then if echo "$COMMIT_MSG" | grep -qiE "^(feat|feature)\(.*\)!:|^BREAKING CHANGE:|^[a-z]+!:"; then
echo "bump_type=major" >> $GITHUB_OUTPUT echo "bump_type=major" >> $GITHUB_OUTPUT