Improve release build error handling and auto-merge the release PR#230
Merged
Conversation
Add `set -euo pipefail` to ensure unset variables and pipeline failures are also caught. Without `set -e`, individual command failures in the build scripts do not cause the script to exit. Since the scripts run via their own shebang, they do not inherit the `set -eo pipefail` default from GitHub Actions `run:` blocks. This could result in a broken release build being committed and pushed silently.
If the script fails between pushing to `tmp-gha-release-build` and deleting it, the temp branch would remain on the remote, potentially causing naming conflicts on a subsequent release attempt.
When triggered by the normal release flow (workflow_run), automatically merge the release/actions PR and delete the branch after the release build and version tags are updated successfully. This replaces the manual "Merge release PR" step. Skipped when triggered directly by a release event (e.g. manual or pre-release).
There was a problem hiding this comment.
Pull request overview
This PR tightens the GitHub Actions release automation by making release-build scripts fail fast and adding an automated step to merge the release PR after tags are updated (as preparation for the upcoming Node.js v24 upgrade).
Changes:
- Enable
set -euo pipefailin release build scripts to stop immediately on errors. - Add an EXIT trap to clean up the temporary remote build branch if failures occur mid-run.
- Add a
MergeReleasePRjob to auto-merge the release PR after tag updates, and update docs/PR body text accordingly.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/github-actions/README.md |
Updates release process docs to reflect automated PR merge. |
packages/github-actions/build-php-actions.sh |
Enables fail-fast bash settings for PHP action build script. |
.github/workflows/github-actions-release.yml |
Adds a job that merges the release PR automatically after updating tags. |
.github/scripts/github-actions-create-and-commit-build.sh |
Enables fail-fast bash settings and adds temp-branch cleanup logic via EXIT trap. |
.github/scripts/create-pr-for-release.mjs |
Updates generated release PR body to describe the automated merge. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Under `set -euo pipefail`, a failed `git push -d` for the temporary branch would fail an otherwise successful release. Guard the delete with an `if` so a cleanup failure does not abort the run, and let the EXIT trap retry it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request:
This PR is a preparatory step for the upcoming Node.js v24 upgrade.
set -euo pipefailtogithub-actions-create-and-commit-build.shandbuild-php-actions.shso a failed build command stops the script immediately instead of being silently ignored.tmp-gha-release-build) if the script fails between pushing and deleting it, so a failed run does not leave the branch behind.MergeReleasePRjob togithub-actions-release.ymlthat merges the release PR automatically after the version tags are updated, removing the previous manual merge step. The job targets the branch fromgithub.event.workflow_run.head_branchand runs only onworkflow_runevents.packages/github-actions/README.mdand the release PR body text to describe the automated merge.