Repository navigation
Decouple prerelease cleanup from the module artifact so Publish-Module succeeds on no-build PRs #376
Description
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
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 module artifact.
Acceptance criteria
Publish-Moduleno longer fails whenBuild-Modulewas skipped and there is nomoduleartifact- 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
CreateReleaseis false
Technical 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.- Candidate approaches: (a) extract cleanup into its own job/step in
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.
Activity
🩹 [Patch]: Prerelease cleanup no longer depends on module artifact (#400