Skip to content

Commit 681c96d

Browse files
committed
Splat build.ps1 arguments as a hashtable so the dispatch inputs work
The workflow_dispatch inputs have no effect except to break the run. Array splatting binds positionally, and build.ps1 declares only switches with no positional parameters, so any non-default input fails the build immediately: build.ps1: A positional parameter cannot be found that accepts argument '-SkipCoverage'. Only the all-defaults path works today, because that leaves the array empty. Splatting a hashtable binds by parameter name instead. This is invisible on push and pull_request, which never populate the inputs, so it only bites someone dispatching the workflow by hand -- which is also the only way to get a matrix run on a branch with no pull request open.
1 parent 3bf1ef4 commit 681c96d

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,14 @@ jobs:
8181
PACK_NUGETS: ${{ github.event_name != 'workflow_dispatch' || inputs.pack_nugets || inputs.publish_nuget }}
8282
CREATE_ARCHIVE: ${{ github.event_name != 'workflow_dispatch' || inputs.upload_artifacts }}
8383
run: |
84-
$buildArguments = @()
85-
if ($env:RUN_TESTS -ne 'true') { $buildArguments += '-SkipTests' }
86-
if ($env:COLLECT_COVERAGE -ne 'true') { $buildArguments += '-SkipCoverage' }
87-
if ($env:PACK_NUGETS -ne 'true') { $buildArguments += '-SkipPack' }
88-
if ($env:CREATE_ARCHIVE -ne 'true') { $buildArguments += '-SkipArchive' }
84+
# Splat a hashtable, not an array. Array splatting binds positionally, and
85+
# build.ps1 declares only switches, so any non-empty array fails with
86+
# "A positional parameter cannot be found that accepts argument '-SkipTests'".
87+
$buildArguments = @{}
88+
if ($env:RUN_TESTS -ne 'true') { $buildArguments['SkipTests'] = $true }
89+
if ($env:COLLECT_COVERAGE -ne 'true') { $buildArguments['SkipCoverage'] = $true }
90+
if ($env:PACK_NUGETS -ne 'true') { $buildArguments['SkipPack'] = $true }
91+
if ($env:CREATE_ARCHIVE -ne 'true') { $buildArguments['SkipArchive'] = $true }
8992
./Build/build.ps1 @buildArguments
9093
9194
# Codecov intermittently fails while importing its verification key from Keybase.

0 commit comments

Comments
 (0)