Skip to content

Fix release workflows failing on unmerged branches#371

Merged
devstress merged 2 commits intomainfrom
copilot/fix-release-workflows
Oct 28, 2025
Merged

Fix release workflows failing on unmerged branches#371
devstress merged 2 commits intomainfrom
copilot/fix-release-workflows

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 28, 2025

Release workflows fail with exit code 1 when release/v1.0.0 branch exists remotely but is not merged to main, preventing the workflow from continuing with version 1.0.0 and recreating the branch.

Root Cause

The check_branch_merged() function returns non-zero exit codes to indicate branch states (0=merged, 1=unmerged, 2=non-existent). GitHub Actions treats any non-zero exit code as a failure, causing the workflow to abort before conditional logic can handle the unmerged state.

Changes

Wrapped check_branch_merged() calls with set +e / set -e to allow non-zero exit codes without failing the workflow:

# Before - workflow fails here when function returns 1
check_branch_merged "$TARGET_VERSION"
result=$?

# After - workflow continues regardless of return code
set +e
check_branch_merged "$TARGET_VERSION"
result=$?
set -e

Modified 6 locations across:

  • .github/workflows/release-major.yml
  • .github/workflows/release-minor.yml
  • .github/workflows/release-patch.yml

Each workflow has two call sites: one for initial version (CURRENT="1.0.0") and one for bumped versions.

Behavior

When release/v1.0.0 exists but is not merged:

  • Workflow continues without error
  • Uses version 1.0.0 (per existing conditional logic)
  • Deletes and recreates branch (per existing cleanup logic)
Original prompt

Fix failed release workflows. It should continue to use 1.0.0 and recreating a new branch.
Run CURRENT="1.0.0"
Default branch:
Starting with version 1.0.0 from main branch
Branch release/v1.0.0 exists remotely
Branch release/v1.0.0 exists but is NOT merged to
Error: Process completed with exit code 1.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: devstress <30769729+devstress@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failed release workflows for version 1.0.0 Fix release workflows failing on unmerged branches Oct 28, 2025
Copilot AI requested a review from devstress October 28, 2025 04:36
@devstress devstress marked this pull request as ready for review October 28, 2025 04:37
@devstress devstress merged commit e552216 into main Oct 28, 2025
@devstress devstress deleted the copilot/fix-release-workflows branch October 28, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants