Repository navigation
Description
Problem Description
Workflow run 40812475380 on main failed in job Release Please at step Merge the Release Pull Request on an Urgent Fix.
The step environment variable RELEASE_PR: ${{ fromJSON(steps.release.outputs.pr).number }} fails with:
Error reading JToken from JsonReader. Path '', line 0, position 0.
when steps.release.outputs.pr is empty (for example, when release-please creates a release instead of creating or updating a release pull request).
Reproduction Steps
- Merge a release pull request into
main. - The
Releaseworkflow starts. release-pleasecreates a release. The outputsteps.release.outputs.pris empty.- The GitHub Actions runner evaluates the step template expressions and fails at
fromJSON(steps.release.outputs.pr).
Expected vs Actual Behavior
Expected: The step does not fail when steps.release.outputs.pr is empty.
Actual: The GitHub Actions runner template evaluation fails before step execution.
Environment Diagnostics
- DevOps CLI Version: 0.14.0
- GitHub Actions runner: ubuntu-24.04
Logs, Traces, or Terminal Output
The template is not valid. .github/workflows/release.yml (Line: 73, Col: 23): Error reading JToken from JsonReader. Path '', line 0, position 0.Pre-Submission Checklist
- I have verified that no sensitive credentials, private keys, or internal tokens are contained in this issue report.
- I have checked existing issues and pull requests to ensure this is not a duplicate.
Proposed design
Problem statement
The release workflow step 'Merge the Release Pull Request on an Urgent Fix' fails when release-please creates a release instead of a pull request. The env expression fromJSON(steps.release.outputs.pr).number is evaluated by the runner and throws a template error on empty input, even though the if condition would skip the step. This blocks every release where no pull request is created.
Acceptance criteria
Requirement: Step skips when PR output is empty
The 'Merge the Release Pull Request on an Urgent Fix' step SHALL NOT evaluate fromJSON on an empty steps.release.outputs.pr value.
Scenario: release-please creates a release with no PR
- WHEN steps.release.outputs.pr is an empty string and steps.release.outputs.releases_created is 'true'
- THEN the workflow run completes without a template evaluation error on that step
Requirement: Step still merges on urgent fix
When steps.release.outputs.pr is non-empty and the pushed commit is an urgent fix, the step SHALL merge the release pull request with gh pr merge --auto --squash.
Scenario: urgent fix with a release PR present
- WHEN steps.release.outputs.pr contains valid JSON with a number field and the pushed commit carries the release-now label
- THEN gh pr merge is called with the correct PR number and --auto --squash flags
Requirement: No new dependencies
The fix SHALL NOT add any new package, action, or runner dependency.
Scenario: review the changed file
- WHEN the diff of .github/workflows/release.yml is inspected
- THEN no new uses: line, no new apt-get install, and no new pip or uv package appears
Existing Tool Considered
GitHub Actions expression language provides fromJson() for parsing JSON in step env blocks, but it throws on empty or null input. The runner image (ubuntu-24.04) ships jq, which parses JSON in a shell script and returns an empty string on empty input, letting the script guard the result. No new dependency is added; the fix moves one expression from the env block into the run script and uses jq.
Key questions
- Why does the env expression fail even though the if condition checks for empty pr?: The runner evaluates all template expressions in a step definition (including env) before or concurrently with the if check. fromJSON('') throws a template error at that point, so the step never reaches the if evaluation. Moving the parse into the run script avoids this because the run script only executes after the if passes. [sources: .github/workflows/release.yml:73]
- Where should the JSON parsing of steps.release.outputs.pr happen?: In the run script, using jq. The env block passes the raw JSON string; the script checks for empty input and then extracts .number with jq. This keeps the expression safe because an empty string in env is a valid value, and jq handles the parse in a context where the script can guard it. (best practice) [sources: .github/workflows/release.yml:67, .github/workflows/release.yml:73]
- Rejected: Keep fromJSON in env, add a null-coalescing guard in the expression. GitHub Actions expressions have no ternary or null-coalesce operator that prevents fromJSON from throwing on empty input. The expression language cannot express 'if empty then skip else parse'.
- Chosen: Move parsing into the run script with jq. jq is pre-installed on ubuntu-24.04 runners. The script can check for empty input before calling jq, and the env block only carries a plain string, which is always a valid template value.
- Rejected: Remove the step and rely on the if condition alone. The if condition is correct but does not prevent the env evaluation error. Removing the step loses the urgent-fix auto-merge feature delivered in feat(release): the release pull request merges itself after its checks when an urgent fix lands #1966.
- Does the fix change the behavior of the urgent-fix auto-merge path?: No. The run script already contains the full logic: find the merged PR for the pushed SHA, check for urgent labels, and call gh pr merge. The only change is how RELEASE_PR is derived: from jq in the script instead of fromJSON in the env block. The script logic is unchanged. [sources: .github/workflows/release.yml:75]
- Is there a dependency on another issue before this fix can be delivered?: No. The fix is a self-contained change to one step in .github/workflows/release.yml. Issue feat(release): the release pull request merges itself after its checks when an urgent fix lands #1966 delivered the urgent-fix feature; this issue fixes a defect in that step. No other issue must be done first. [sources: .github/workflows/release.yml:67]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Oct 29, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
A workflow step crashes when release-please output is empty; this is a defect fix.The failure blocks every release where release-please creates a release instead of a PR.The failed run 40812475380 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 with the label priority/p0-critical.Releases cannot ship until the step handles the empty PR output case.The fix is a guard or conditional around the fromJSON call in one workflow step.Both touch the release workflow auto-merge step; #1966 delivered the feature, this candidate reports a defect in that step.fix(release): parse release pull request number safely in urgent merge (
devops-cli-service commentedon Oct 29, 2026
Status set to Ready at 38a0a44 (see proposed design in issue body).