🐛 fix(ci): version-bump fallback for workflow_dispatch trigger

The CI workflow_dispatch event provides no head_commit, so
${{ github.event.head_commit.message }} expands to empty.
ci-version-bump.sh requires a commit message and exits 1 if absent,
causing manually-triggered CI runs to fail in the version-bump step
even though the actual tests passed.

Fix: fall back to `git log -1 --pretty=%B` when the GitHub event
context provides no commit message. Maintains push-event behavior
unchanged (head_commit.message still primary source).

Observed in CI #615 (manual trigger after PR #28 merge): tests passed,
build OK, but version-bump failed → entire workflow marked FAILURE.

🤖 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-03 16:41:59 +02:00
parent a57bf4dd19
commit 3e20362daf

View File

@@ -297,7 +297,14 @@ jobs:
# Check for version bump on main branch # Check for version bump on main branch
if [ "${{ github.ref }}" = "refs/heads/main" ]; then if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "🔖 Checking for version bump..." echo "🔖 Checking for version bump..."
./scripts/ci-version-bump.sh "${{ github.event.head_commit.message }}" --no-push # ${{ github.event.head_commit.message }} is empty on workflow_dispatch (manual trigger).
# Fall back to the latest commit message from `git log` so the script always has input.
COMMIT_MSG="${{ github.event.head_commit.message }}"
if [ -z "$COMMIT_MSG" ]; then
COMMIT_MSG=$(git log -1 --pretty=%B)
echo " (using git log -1 because head_commit.message is empty - probably workflow_dispatch)"
fi
./scripts/ci-version-bump.sh "$COMMIT_MSG" --no-push
fi fi
# Single push for all commits (this is the ONLY push in the entire workflow) # Single push for all commits (this is the ONLY push in the entire workflow)