fix: don't let a false trailing condition fail publish.yml steps#45
Merged
Conversation
Two steps in publish.yml end their run: script with `cond && action` as the last statement. bash's exit status is the last command's, so when the condition is false (no default-branch zip to persist as a source, or no release yet to alias as stable/) the step — and the job — fails even though nothing went wrong. Hit for real on PandABlocks-FPGA: a fresh migration with no MyST-built release yet makes stable_src empty, and the Generate switcher.json step fails despite a correct assemble. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two
run:steps inpublish.ymlend withcond && actionas their final statement. A shell script's exit status is its last command's, so when the condition is false the step (and job) fails even though nothing went wrong:[ -d ... ] && [ -f "$dzip" ] && { ...persist _sources...; }— fails when there's no default-branch zip to persist.[ -n "$stable_src" ] && ln -s ...— fails when there's no release yet to alias asstable/.Hit for real on PandABlocks-FPGA (PR #289 there): a fresh migration with no MyST-built release yet leaves
stable_srcempty, sogeneratesucceeds but the step still reports failure andpublishnever deploys. Introduced by 811914e (between v0.18.0 and v0.19.0) — any repo bumping past v0.18.0 without an existing release hits this.Fix: append
|| trueto both trailing conditionals so a false condition is treated as "nothing to do", not "step failed".Test plan
[ -n "" ] && echo xas a script's last line exits 1 underset -e)publishjob goes green