Skip to content

Pass the release flag as part of one options array - #17

Merged
JDS300 merged 1 commit into
mainfrom
fix/publish-flag-splat
Aug 14, 2026
Merged

Pass the release flag as part of one options array#17
JDS300 merged 1 commit into
mainfrom
fix/publish-flag-splat

Conversation

@JDS300

@JDS300 JDS300 commented Aug 14, 2026

Copy link
Copy Markdown
Owner

The v0.4.0-rc.1 dispatch got all the way to publishing and then failed:

no matches found for `-`

Cause

Mine, from #15:

$flags = if ($prerelease) { @('--prerelease') } else { @('--latest') }
gh release create $tag @assets --repo $env:GITHUB_REPOSITORY @flags ...

PowerShell unrolls a single-element array returned from an if expression, so $flags was the string --prerelease, not an array. Splatting a scalar string is not splatting an array, and gh ended up with a bare -, which it tried to read as an asset filename.

The @assets splat in the same command works only because it always holds five elements and so never unrolls — which is exactly what made the pattern look safe to copy.

Fix

The flag joins the other options in one array that always holds at least six elements, so there is nothing that can unroll:

$options = @('--target', $env:GITHUB_SHA, '--title', ..., '--notes', ...)
if ($prerelease) { $options += '--prerelease' } else { $options += '--latest' }
gh release create $tag @assets --repo $env:GITHUB_REPOSITORY @options

+= on an array stays an array regardless of length, so the shape no longer depends on how many flags happen to be added.

What the failed run proved

It reached the publish step, so everything before it now works:

Nothing was published, so there is still no v0.4.0-rc.1 release or tag to clean up.

Verification

Release quality gate ALL PASS; workflow parses. The publish path cannot be executed anywhere but a real dispatch — there is no pwsh on this machine — so re-cutting the candidate is the test, as it was for this bug.

🤖 Generated with Claude Code

The v0.4.0-rc.1 dispatch reached the publish step and failed with "no matches
found for -".

PowerShell unrolls a single-element array returned from an if expression, so
$flags held the string "--prerelease" rather than an array, and splatting a
scalar string left gh with a bare "-" to read as an asset filename. The
@assets splat beside it works only because it always holds five elements and
so never unrolls, which is what made the pattern look safe to copy.

The flag now joins the other options in one array that always holds at least
six elements, and += keeps it an array however many flags are added, so the
shape no longer depends on how many there happen to be.

The failed run proved everything ahead of it: the staged package verified
byte-for-byte across a Linux-packaged zip and a Windows checkout, the tag and
flag guard accepted the candidate tag, and both artifact uploads succeeded.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@JDS300
JDS300 merged commit cbcc776 into main Aug 14, 2026
6 checks passed
@JDS300
JDS300 deleted the fix/publish-flag-splat branch August 14, 2026 14:56
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.

1 participant