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
The Publish-Module job fails on pull requests that do not rebuild the module, because prerelease cleanup is bundled behind the module-artifact download inside the Publish-PSModule composite action. On a PR with no important changes, Build-Module is skipped (so no module artifact exists), yet Publish-Module still runs to clean up prereleases — and dies at actions/download-artifact before cleanup can execute.
Request
Current experience
On a PR that changes no important files (nothing matching ImportantFilePatterns, e.g. ^src/, ^README\.md$), the resolved settings are HasImportantChanges: false → Run.BuildModule: false, so Build-Module is skipped and the module artifact is never uploaded. The same PR still has Run.PublishModule: true with ReleaseType: None / CreateRelease: false — nothing is published; the job runs solely to clean up prereleases (as documented in workflow.yml: "Abandoned PR — Cleans up prereleases … no version published"). But PSModule/Publish-PSModule@v3.0.0 runs a fixed step sequence — Download module artifact (unconditional) → publish.ps1 → cleanup.ps1 — so the job fails at the first step:
##[error]Unable to download artifact(s): Artifact not found for name: module
Prerelease cleanup runs successfully on PRs where the module was not rebuilt (no important changes) and on abandoned PRs, without requiring the module artifact.
Acceptance criteria
Publish-Module no longer fails when Build-Module was skipped and there is no module artifact
Prerelease cleanup runs independently of the module artifact and of publish.ps1
When a module is built and published, cleanup still excludes the just-published tag (current behavior preserved)
No module download / Gallery publish / GitHub Release is attempted when CreateRelease is false
Technical decisions
cleanup.ps1 needs none of the artifact — it only reads the PR head ref and calls gh release list / gh release delete. Its sole tie to publish is the step if: reading PSMODULE_PUBLISH_PSMODULE_CONTEXT_IsPrerelease (set by publish.ps1), which must be removed for standalone cleanup.
Publish-Module's needs: already excludes Build-Module, so the job is intended to run without a build; only the action's fixed step order prevents it.
Candidate approaches: (a) extract cleanup into its own job/step in Publish-Module.yml that does not download the artifact — preferred, and aligns with the SRP split in Publish-PSModule: Split Gallery publishing from GitHub Release creation #330; (b) make the artifact download + Gallery publish + Release creation conditional on CreateRelease while cleanup always runs.
Implementation plan
Move prerelease cleanup out of the publish path so it does not depend on download-artifact or publish.ps1
Gate the module download + Gallery publish + GitHub Release on an actual release being created (CreateRelease)
Compute the "exclude just-published tag" behavior without relying on publish.ps1 env vars (skip exclusion when nothing was published)
Ensure cleanup runs on no-build PRs and abandoned PRs
Testing
No-build PR (no important changes): Publish-Module succeeds and cleans up prereleases
Prerelease PR (with build): prerelease published, cleanup excludes the published tag
Merged PR to default branch: stable released, prior prereleases cleaned up
Abandoned PR: prereleases for the branch cleaned up, no publish attempted
The
Publish-Modulejob fails on pull requests that do not rebuild the module, because prerelease cleanup is bundled behind the module-artifact download inside thePublish-PSModulecomposite action. On a PR with no important changes,Build-Moduleis skipped (so nomoduleartifact exists), yetPublish-Modulestill runs to clean up prereleases — and dies atactions/download-artifactbefore cleanup can execute.Request
Current experience
On a PR that changes no important files (nothing matching
ImportantFilePatterns, e.g.^src/,^README\.md$), the resolved settings areHasImportantChanges: false→Run.BuildModule: false, soBuild-Moduleis skipped and themoduleartifact is never uploaded. The same PR still hasRun.PublishModule: truewithReleaseType: None/CreateRelease: false— nothing is published; the job runs solely to clean up prereleases (as documented inworkflow.yml: "Abandoned PR — Cleans up prereleases … no version published"). ButPSModule/Publish-PSModule@v3.0.0runs a fixed step sequence —Download module artifact(unconditional) →publish.ps1→cleanup.ps1— so the job fails at the first step:Observed on PSModule/Template-PSModule#26 (run https://github.com/PSModule/Template-PSModule/actions/runs/29088726916/job/86348735543).
Desired experience
Prerelease cleanup runs successfully on PRs where the module was not rebuilt (no important changes) and on abandoned PRs, without requiring the
moduleartifact.Acceptance criteria
Publish-Moduleno longer fails whenBuild-Modulewas skipped and there is nomoduleartifactpublish.ps1CreateReleaseis falseTechnical decisions
cleanup.ps1needs none of the artifact — it only reads the PR head ref and callsgh release list/gh release delete. Its sole tie to publish is the stepif:readingPSMODULE_PUBLISH_PSMODULE_CONTEXT_IsPrerelease(set bypublish.ps1), which must be removed for standalone cleanup.Publish-Module'sneeds:already excludesBuild-Module, so the job is intended to run without a build; only the action's fixed step order prevents it.Publish-Module.ymlthat does not download the artifact — preferred, and aligns with the SRP split in Publish-PSModule: Split Gallery publishing from GitHub Release creation #330; (b) make the artifact download + Gallery publish + Release creation conditional onCreateReleasewhile cleanup always runs.Implementation plan
download-artifactorpublish.ps1CreateRelease)publish.ps1env vars (skip exclusion when nothing was published)Testing
Publish-Modulesucceeds and cleans up prereleasesRelated issues