ci: fix Release workflow failing on empty changelog pipelines#421
Conversation
The bump-version composite action's changelog pipelines fail under `bash -e -o pipefail` whenever `grep` finds no matching lines and exits 1, which aborts the step before the `if [ -z "$ENTRIES" ]` fallbacks can run. This caused the Release (v3) workflow to fail at the `echo "$ENTRIES" > /tmp/changelog_entries.txt` line for the v3.9.0 release. Two compounding causes: 1. The `bump` job's checkout uses default `fetch-depth: 1`/`fetch-tags: false`, so `git describe` finds no tags and `git log HEAD --merges` is empty (squash merges have one parent and don't show under `--merges`). 2. `grep -v '^$'` and `grep -iv '^release\|^chore(release)'` exit 1 on empty input, which propagates through `pipefail` and trips `set -e`. Fix: - release.yml / release-v2.yml: add `fetch-depth: 0` and `fetch-tags: true` to the bump job's checkout so the changelog script has full history. - bump-version/action.yml: append `|| true` to both changelog pipelines so empty results fall through to the existing fallbacks, and switch the file write to `printf` for safer multi-line output.
There was a problem hiding this comment.
LGTM — small, well-scoped CI fix with clear root-cause analysis.
Extended reasoning...
Overview
This PR fixes the Release (v3) and Release (v2) workflows that were aborting in the bump-version step. Changes are limited to two workflow files and one composite action under .github/ — no plugin runtime code is touched.
Security risks
None. CI-only changes. The added fetch-depth: 0 / fetch-tags: true simply broaden the checkout to include history and tags (read-only). The || true and printf changes affect how an empty pipeline is handled and how a string is written to /tmp/changelog_entries.txt. No credentials, permissions, or external interactions are involved.
Level of scrutiny
Low. The diagnosis in the PR description matches well-known bash gotchas — grep exits 1 on no matches, and under set -e -o pipefail that kills the step before the existing if [ -z "$ENTRIES" ] fallback can run. Appending || true is the idiomatic remedy. Replacing echo with printf '%s\n' correctly handles values that start with a dash (e.g. - See release notes), which echo would have interpreted as a flag in some shells. The checkout fetch-depth: 0 / fetch-tags: true aligns this job with the sibling reusable workflows that already worked.
Other factors
The bug hunter found no issues. The PR description includes manual verification of both the empty-input and real-history pipelines, plus a YAML validation step. Recovery instructions for the in-flight v3.9.0 release are documented.
|
Merge? |
`release-v2.yml` has the same structural issue as `release.yml`: its `release` job calls the reusable `OneSignal/sdk-shared/.github/workflows/create-release.yml`, which runs `gh pr create`. With only `contents: write` on the caller, the next v2 release dispatch would fail with the same `Resource not accessible by integration (createPullRequest)` error. Restore the v2/v3 lockstep maintained by #420 and #421.
One Line Summary
Fix the `Release (v3)` and `Release (v2)` workflows that fail in the bump-version step when the changelog pipelines find no matching lines.
Motivation
Triggering Release (v3) for v3.9.0 (run 25944054673) failed in the `bump` job's "Generate changelog from git history" step. The visible failure was on `echo "$ENTRIES" > /tmp/changelog_entries.txt`, but the actual abort happens earlier inside the same script.
Two compounding causes:
Verified by pulling the failed job log via `gh api repos/OneSignal/OneSignal-WordPress-Plugin/actions/jobs/76268196830/logs`.
Scope
Changes
Testing
Manual
Recovery for the in-flight v3.9.0 release
Once this PR is merged:
```bash
gh api -X DELETE repos/OneSignal/OneSignal-WordPress-Plugin/git/refs/heads/rel/3.9.0
```
Affected code checklist
Checklist