From ee96a3f42b314289fca2802a273001b9e1bdee96 Mon Sep 17 00:00:00 2001 From: Steven Gates Date: Tue, 8 Sep 2026 09:13:00 -0500 Subject: [PATCH] fix(tag): pass the script's arguments as a hash table, not an array Run 34236210310 died with "A positional parameter cannot be found that accepts argument '-Title'". Expanding an ARRAY into a PowerShell script binds every element by position, so '-Version' landed in $Version, '1.0.52' in $Sha, '-Sha' in $Title, and '-Title' had no position left to bind to. The parameter names were being passed as values. A hash table binds by name, which is what this needed. Inputs now arrive as environment variables rather than being interpolated into the script text, so a title containing a quote cannot break the parse either. --- .github/workflows/tag.yml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 5cbce4c..d6283f2 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -85,18 +85,32 @@ jobs: jarsigner -verify "$expected" | grep -q 'jar verified' echo "$expected is present and still verifies." + # Arguments go in a hash table, NOT an array. Expanding an array into a PowerShell script + # binds each element by position, so the parameter names themselves get passed as values: + # '-Version' lands in $Version, the real version in $Sha, and the last name has no position + # left to bind to. A hash table binds by name, which is what this needs. + # + # Inputs arrive as environment variables rather than being pasted into the script text, so a + # title containing a quote cannot break the parse. - name: Cut the tag and release shell: pwsh + env: + VERSION: ${{ inputs.version }} + SHA: ${{ inputs.sha }} + TITLE: ${{ inputs.title }} + USE_NOTES: ${{ inputs.notes }} run: | - $tagArgs = @( - '-Version', '${{ inputs.version }}' - '-Sha', '${{ inputs.sha }}' - ) - if ('${{ inputs.title }}') { $tagArgs += @('-Title', '${{ inputs.title }}') } - $notes = "notes/github-release-notes-${{ inputs.version }}.md" - if ('${{ inputs.notes }}' -eq 'true') { - if (-not (Test-Path $notes)) { throw "Curated notes requested but $notes is not present — pass run_id, or leave notes off to use --generate-notes." } - $tagArgs += @('-NotesFile', $notes) + $tagArgs = @{ + Version = $env:VERSION + Sha = $env:SHA + } + if ($env:TITLE) { $tagArgs.Title = $env:TITLE } + if ($env:USE_NOTES -eq 'true') { + $notesFile = "notes/github-release-notes-$($env:VERSION).md" + if (-not (Test-Path $notesFile)) { + throw "Curated notes requested but $notesFile is not present — pass run_id, or leave notes off to use --generate-notes." + } + $tagArgs.NotesFile = $notesFile } ./scripts/tag-release.ps1 @tagArgs