Repository navigation
Fix: Keep gh stderr out of the release JSON - #137
ModeSevenIndustrialSolutions merged 1 commit into
Conversation
|
Maintainer instruction for the next revision round. pre-commit.ci fails this pull request on Cause, reproduced. The step under test pipes through Required change (nothing else):
Do not change |
34e86b1 to
98b8288
Compare
98b8288 to
cddccbb
Compare
e839517
cddccbb to
e839517
Compare
The release workflow's check-promoted step captured 'gh release view'
with stderr merged into stdout and parsed the result with jq. Any
text gh printed to stderr on success, such as an update notice or a
deprecation warning, preceded the JSON: under 'bash -eo pipefail' jq
failed and the step exited 5, failing even an idempotent re-run of a
promoted release; without -e, an empty value fell through to
promotion.
Capture stdout only and send stderr to a temporary file reported when
gh fails. Accept only an explicit boolean isDraft and fail with an
error naming any other value, rather than promoting on an unknown
one. The step's already_promoted output is unchanged.
No other reusable workflow parses a '$(... 2>&1)' capture on its
success path.
Add tests/test-release-check-promoted.sh, which runs the step's
extracted run: block against a stub gh, and run it as a prek hook.
Review round 1 (maintainer instruction): pre-commit.ci's runner has
no jq, so the new hook failed there. List
release-check-promoted-fixtures under ci.skip, with the reason for
each skipped hook in the comment above it; the 'Linting (self,
ci.skip)' job in linting-action.yaml runs every ci.skip hook, so it
enforces the fixtures on GitHub's runners, which ship jq. Correct
that job's stale comment, which counted one hook.
Review round 2 (Copilot): report jq's own error and exit 1 when jq
fails, so a missing jq or a response that is not JSON names its
cause instead of an empty isDraft; add fixtures for both. Accept a
quoted or unquoted step id when the fixtures extract the step.
Review round 3 (maintainer decision on Copilot's two mktemp findings):
give both mktemp calls this change adds an explicit template under
${TMPDIR:-/tmp}, in the check-promoted step and in the fixture
script, so they behave the same on GNU, macOS and the BSDs. The
other tests/test-*.sh scripts are out of scope and unchanged.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: lf-releng-code-monkey-bot[bot] <332050256+lf-releng-code-monkey-bot[bot]@users.noreply.github.com>
e839517 to
aaf7c43
Compare
d448f10
into
lfreleng-actions:main

Closes #136
Authored by an AI agent; human review required
claude-opus-5.5via GitHub Copilot CLI1297261cdcc5a9fb3cef683a45fd1f7944d36bb2bash tests/test-release-check-promoted.shprek run --all-filesaislop scan --changes --base 1297261cdcc5a9fb3cef683a45fd1f7944d36bb2 --jsonprek run --hook-stage commit-msg --commit-msg-filename <HEAD message> (fails only on replay-added bot Signed-off-by length)prek run --hook-stage commit-msg --commit-msg-filename <HEAD message without bot trailer>git log --raw --format=%h 1297261cdcc5a9fb3cef683a45fd1f7944d36bb2..HEADThe
github-code-monkey-botworkflow opened this pull request.Nobody has merged it; a maintainer must review it first.
Review findings on this pull request are answered by a later revision round of this workflow, up to ten rounds; a maintainer must act on any finding that remains after that, and reviews every round before merge.
Round 3 of revision, on its base.
What this pull request does
Fixes #136. The
check-promotedstep in.github/workflows/release.yamlcapturedgh release viewwith stderr merged into stdout, so a warningghprinted on success broke thejqparse. Underbash -eo pipefailthe step failed, even on an idempotent re-run. Without-eit fell through to promoting a release that was already published.ghfails.jqfailures, such as a missingjqor a response that is not JSON, exit 1 with jq's own error.isDraftmust be exactlytrueorfalse. Any other value is an::error::that names it, followed byexit 1. Thealready_promotedoutput is unchanged.$(… 2>&1)capture on its success path.tests/test-release-check-promoted.shextracts the step'srun:block and runs it underbash -eo pipefailagainst a stubgh, with 11 cases. It runs as therelease-check-promoted-fixturesprek hook. That hook is listed underci.skipbecause pre-commit.ci has nojq. TheLinting (self, ci.skip)job runs it on GitHub's runners instead.This round (3)
Following the maintainer's decision on Copilot's two
mktempthreads, eachmktempcall this change adds now uses an explicit template under${TMPDIR:-/tmp}:release.yaml:stderr_file=$(mktemp "${TMPDIR:-/tmp}/check-promoted.XXXXXX")tests/test-release-check-promoted.sh:work="$(mktemp -d "${TMPDIR:-/tmp}/test-release-check-promoted.XXXXXX")"mktempis still in the no-jq case's tool list, and the othertests/test-*.shscripts are unchanged. I amended the single commit and left the title as it was. I did not rebase, because the PR is mergeable and nobody asked for a rebase.What I ran
bash tests/test-release-check-promoted.sh: 11 passed, exit 0prek run --all-files: exit 0aislop scan --changesagainst the base: no diagnosticsSigned-off-bytrailer, which is longer than 80 characters. The workflow replaces that trailer.For the reviewer
Please confirm that
Linting (self, ci.skip) / Lint: release-check-promoted-fixturesran and passed on the new head. This session cannot see checks.