Skip to content

fix(ci): guard fromJSON against empty release PR output#91

Merged
PAMulligan merged 1 commit into
mainfrom
fix/release-please-fromjson-empty
May 26, 2026
Merged

fix(ci): guard fromJSON against empty release PR output#91
PAMulligan merged 1 commit into
mainfrom
fix/release-please-fromjson-empty

Conversation

@PAMulligan
Copy link
Copy Markdown
Contributor

Problem

The release-please workflow failed with:

Error: The template is not valid. .github/workflows/release-please.yml (Line: 54, Col: 22): Error reading JToken from JsonReader. Path '', line 0, position 0.

On runs where release-please does not maintain a release PR (e.g. the release/merge run), steps.release.outputs.pr is an empty string. A step's env: expressions are evaluated even when the step is skipped by its if: guard, so fromJSON('') throws. (The identical fromJSON on line 35 is safe because with: inputs are only evaluated when the step actually runs.)

Fix

Short-circuit the expression so fromJSON is only invoked when pr is non-empty:

PR_BRANCH: ${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).headBranchName || '' }}

🤖 Generated with Claude Code

The release-please workflow failed template validation on runs where no
release PR exists (e.g. the release/merge run): steps.release.outputs.pr
is an empty string, and a step's env: expressions are evaluated even when
the step is skipped by its if: guard, so fromJSON('') raised
"Error reading JToken from JsonReader."

Short-circuit the expression so fromJSON is only called when pr is set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 26, 2026

Deploying chat-widget with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0c00839
Status: ✅  Deploy successful!
Preview URL: https://c7968422.chat-widget-ejc.pages.dev
Branch Preview URL: https://fix-release-please-fromjson.chat-widget-ejc.pages.dev

View logs

@PAMulligan PAMulligan self-assigned this May 26, 2026
@PAMulligan PAMulligan added bug Something isn't working backend Cloudflare Workers API and AI integration labels May 26, 2026
@PAMulligan PAMulligan moved this from Todo to Done in PMDS Open Source Roadmap May 26, 2026
@PAMulligan PAMulligan added this to the v1.1.0 milestone May 26, 2026
@PAMulligan PAMulligan merged commit 5f47613 into main May 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Cloudflare Workers API and AI integration bug Something isn't working

Projects

Development

Successfully merging this pull request may close these issues.

1 participant