Skip to content

fix(action): read release outputs from a --output file, not scraped stdout - #605

Merged
goosewobbler merged 1 commit into
mainfrom
fix/594-tier2-output-file
Jul 21, 2026
Merged

goosewobbler merged 1 commit into
mainfrom
fix/594-tier2-output-file

Conversation

@goosewobbler

@goosewobbler goosewobbler commented Jul 21, 2026 •

Copy link
Copy Markdown
Owner

Implements Tier 2 of #594 — the comprehensive fix for stdout-scraping fragility in the Action's outputs. (Tier 1, #597, already hardened just tags via a git fallback.)

Problem

run-action.mjs derives the Action's release-mode outputs (has-changes, tags, version-output, release-output) by parsing the CLI's stdout. Any subprocess or log noise on stdout — a single stray byte — breaks JSON.parse and silently empties them. This is the same failure class that stranded the v0.41.1 action dist.

Fix — write the result to a file, read it back

  • --output <path> flag on the JSON-result commands (release, gate, standing-pr update|publish), via a shared emitResult() helper: when set, the result JSON is written to that file; otherwise --json prints to stdout exactly as before.
  • run-action creates a temp --output file for those modes, passes it, and reads the structured result from the file — immune to stdout noise. It falls back to captured stdout if the file is missing, and Tier 1's git-derived tags remains the final backstop.
  • Preview is untouched (its markdown output legitimately uses stdout).

Now every release output comes from the file, not a stdout scrape.

Validation

  • New tests: emitResult unit (file vs stdout vs no-op), and run-action (reads outputJson from the file even when the fake CLI floods stdout with noise; no --output for preview).
  • pnpm typecheck 15/15; biome clean; release package + action-runner suites green (870 tests).

Note

This touches packages/release/src, so — unlike the earlier action-only PRs — it should drive a natural standing-PR release itself.

🤖 Generated with Claude Code

Greptile Summary

This PR moves structured Action results from captured stdout to temporary output files. The main changes are:

  • Adds a shared helper for writing command results to a file or stdout.
  • Adds --output support to release, gate, and standing-PR commands.
  • Reads Action outputs from temporary files with stdout as a fallback.
  • Adds unit and integration coverage for file output and noisy stdout.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the updated code.

Important Files Changed

Filename Overview
packages/release/src/commands/emitResult.ts Adds shared JSON result emission to an output file or stdout.
packages/release/src/commands/gate-command.ts Adds file-based output support to the gate command.
packages/release/src/commands/release-command.ts Adds file-based output support to the release command.
packages/release/src/commands/standing-pr-command.ts Adds shared file-based result emission to standing-PR commands.
scripts/run-action.mjs Captures structured command results through a temporary file and preserves stdout fallback behavior.
test/integration/action-runner.spec.ts Covers structured file output with noisy stdout and confirms preview mode remains unchanged.

Reviews (2): Last reviewed commit: "fix(action): read release outputs from a..." | Re-trigger Greptile

Comment thread scripts/run-action.mjs
@goosewobbler
goosewobbler force-pushed the fix/594-tier2-output-file branch from cb557e7 to 90257f4 Compare July 21, 2026 01:50
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Standing release PR: #595 · v0.41.2 queued (4 packages) · open 5h 19m · ✅ ready to merge

Release Preview — v0.41.1 → v0.41.2

Note: Labels on this PR are advisory in standing-pr mode. Bumps come from conventional commits in the standing PR; override by editing labels on the standing PR itself. Add release:immediate to bypass the standing PR and release this PR directly.

These changes will be added to the release PR (#595) when merged:

Changelog

monorepo 0.41.1 → 0.41.2

Fixed

  • read release outputs from a --output file, not scraped stdout (action)

All packages → 0.41.2 (sync versioning)

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release

After merge — predicted release

No version escalation — this PR's changes will be included in the queued release without affecting the projected versions.

Package Standing PR This PR After merge
monorepo 0.41.2 0.41.2 0.41.2

Updated automatically by ReleaseKit

…tdout

Tier 2 of #594. The JSON-result CLI commands (release, gate, standing-pr
update/publish) gain a `--output <path>` flag that writes the result JSON to a
file via a shared emitResult() helper. run-action passes a temp --output file for
those modes and reads the structured result from it (falling back to stdout only
if the file is missing, then to Tier 1's git-derived tags).

This removes the stdout-scraping fragility from ALL release outputs
(has-changes / tags / version-output / release-output), not just `tags` (Tier 1,
#597): a stray byte of subprocess or log noise on stdout can no longer corrupt
them. Preview mode is unchanged (its markdown output stays on stdout).

Addresses #594 (Tier 2).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6CmYRXTZQYs4MNo6AETxT
@goosewobbler
goosewobbler force-pushed the fix/594-tier2-output-file branch from 90257f4 to 53372e0 Compare July 21, 2026 01:53
@goosewobbler goosewobbler changed the title feat(action): read release outputs from a --output file, not scraped stdout fix(action): read release outputs from a --output file, not scraped stdout Jul 21, 2026
@goosewobbler
goosewobbler merged commit 0c7f64a into main Jul 21, 2026
32 checks passed
@goosewobbler
goosewobbler deleted the fix/594-tier2-output-file branch July 21, 2026 01:57
@github-actions github-actions Bot mentioned this pull request Jul 21, 2026
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.

Harden Action release outputs against stdout-scraping (silent-empty tags/has-changes)

1 participant