You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Publish-PSBuildModule reports success when the publish fails #203
Publish-PSBuildModule reports success for a module it never published.
What happens
Publish-Module reports a failed publish as a non-terminating error — an
unregistered repository, a rejected API key, a repository the credential cannot
authenticate to. Publish-PSBuildModule calls it at the default $ErrorActionPreference, so the error is written to the error stream and the
command returns normally. Publish-PSBuildModule then returns normally after
it, and the Publish task in both psakeFile.ps1 and IB.tasks.ps1 reports
success.
Measured against the built module on main:
Publish-PSBuildModule-Path $existingModulePath-Version '1.0.0'`-Repository 'PSBuildNoSuchRepository'-NuGetApiKey 'not-a-real-key'# Get-PackageSource: Unable to find repository 'PSBuildNoSuchRepository'.# ...and then it returns. Nothing throws.
Why it matters
This is the release path. .github/workflows/publish.yaml runs ./build.ps1 -Task Publish when a GitHub release is published, and a consumer's
release workflow does the same. A green build after a publish that did not
happen is the worst failure mode this particular function has: the artifact is
simply absent from the gallery and nothing said so.
It was invisible until now because Publish-PSBuildModule had no tests at all
(#103) — 0 of 21 instructions covered, literally rather
than as an artifact of background-job instrumentation.
Fix
Default -ErrorAction Stop on the Publish-Module call, forwarded through the
same $PSBoundParameters loop that already forwards NuGetApiKey and Credential, so an explicit -ErrorAction from the caller still wins.
Activity