Repository navigation
fix(ci): explicit exit 0 in the packed-assembly-version self-test and guard (publish-nuget 39152113710) - #48
Merged
Conversation
…explicit exit 0 - GitHub's pwsh shell appends exit $LASTEXITCODE, and the self-test's last NEGATIVE case left it 1, failing a passing step (publish-nuget run 39152113710) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (publish-guards.yml), not only at publish - today's failure was the step's first CI run Co-Authored-By: Claude Opus 5.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.
Why
publish-nuget run 39152113710 failed at Guard - the packed-assembly-version guard's self-test. The log printed
check-packed-assembly-versions self-test: 6 ok, 0 failedand thenProcess completed with exit code 1. Nothing was pushed.The cause:
if ($fail -gt 0) { exit 1 }and has no explicit success exit.pwsh -File …) on a negative package, where the guard exits 1 on purpose, so$LASTEXITCODEis 1 at the end.shell: pwshtemplate appendsif ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }, which turns a passing self-test into a failed step.The step is new since the 1.3.5 tag, so this is the first run that could show it.
Change
check-packed-assembly-versions.selftest.ps1ends with an explicitexit 0after the$failcheck.check-packed-assembly-versions.ps1(the guard) ends with an explicitexit 0too. It runs no native command today, so it was safe, but its verdict should not rest on that staying true. Its failures are terminatingWrite-Errors ($ErrorActionPreference = 'Stop').shell: pwshsteps in the workflows and no other.ps1scripts.Proof
Run locally through GitHub's own harness: the step's
run:text in a temp.ps1with$ErrorActionPreference = 'stop'prepended and theexit $LASTEXITCODEcheck appended, invoked aspwsh -command ". '<file>'".dfc8143(RED first)6 ok, 0 failed6 ok, 0 failedBad6 ok, 1 failedAlso: the self-test runs on every PR
.github/workflows/publish-guards.yml, onpull_requestandpushto master, runs the same self-test step the same way (shell: pwsh), so a regression of today's failure shows on the PR instead of at publish. Today's failure was the step's first-ever CI run.64f4574: run 39152836929, success.actionlintis clean.🤖 Generated with Claude Code