fix(action): allow manual release trigger without releasable commits - #77
Conversation
Architecture review · analyzing…⏳ CodeBoarding is analyzing the architecture changes in this PR. This usually takes a few minutes. codeboarding-action · run 31165462097 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93825f5fc7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| release-as: ${{ inputs.release_as || '' }} | ||
|
|
||
| - name: Create release trigger commit for manual forced release | ||
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.force_release == true && steps.release.outputs.release_created == 'false' }} |
There was a problem hiding this comment.
Treat an unset release output as no release
When release-please-action v4 creates no release, the root release_created output is unset rather than the literal string 'false'. Consequently, a manual dispatch with force_release=true skips this step in exactly the no-release case it is intended to handle; test the output for falsiness or use the aggregate releases_created output instead.
Useful? React with 👍 / 👎.
| echo "force_release requested, but release_as is required" >&2 | ||
| exit 1 | ||
| fi | ||
| git config user.name "github-actions[bot]" |
There was a problem hiding this comment.
Check out the repository before running git
When this forced step does run, the only actions/checkout invocation in the workflow occurs later and is guarded by release_created. The release-please action uses the GitHub API and does not populate GITHUB_WORKSPACE, so this first local git config runs outside a repository and exits under set -e before the trigger commit can be created.
Useful? React with 👍 / 👎.
| git checkout main | ||
| git reset --hard origin/main | ||
| git commit --allow-empty -m "fix(action): trigger manual release ${{ inputs.release_as }}" | ||
| git push origin HEAD:main |
There was a problem hiding this comment.
Do not rely on a GITHUB_TOKEN push to rerun the workflow
After this commit is pushed, the release-please action has already completed, so another workflow run is required to process the new fix commit. A push authenticated with the workflow's GITHUB_TOKEN does not trigger another push workflow, however, so even after adding the missing checkout this dispatch will stop after creating the commit and never create the requested release; rerun release-please in this job or use credentials that can trigger the follow-up workflow.
Useful? React with 👍 / 👎.
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git checkout main | ||
| git reset --hard origin/main | ||
| git commit --allow-empty -m "fix(action): trigger manual release ${{ inputs.release_as }}" |
There was a problem hiding this comment.
Preserve the requested version for the follow-up release
If the push is changed so that it does trigger another run, that run is a push event and therefore has no inputs.release_as; the new commit is simply a conventional fix commit, which requests a patch bump. Thus a forced non-patch version such as 2.0.0 would instead produce the next patch release. Encode the requested version in a Release-As footer or otherwise pass it to the run that processes this commit.
Useful? React with 👍 / 👎.
| release-as: ${{ inputs.release_as || '' }} | ||
|
|
||
| - name: Create release trigger commit for manual forced release | ||
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.force_release == true && steps.release.outputs.release_created == 'false' }} |
There was a problem hiding this comment.
Check for a release PR before adding the trigger commit
On a forced dispatch where releasable commits already exist, release-please can create or update a release PR without publishing a GitHub release, so release_created remains false or unset. Once the output comparison above is corrected, this fallback will therefore add a fabricated fix commit even though release-worthy commits were detected, contrary to the input's stated behavior; gate the fallback on whether a release PR was produced or updated rather than only on release publication.
Useful? React with 👍 / 👎.
Summary
force_releaseto force release path in GitHub Actions.fix(action): ...commit onmainso release workflow can proceed.How to use
release_as: e.g.1.10.2force_release:true