🚀 [Feature]: Version output always emitted regardless of publish decision#4
Open
Marius Storhaug (MariusStorhaug) wants to merge 18 commits into
Open
🚀 [Feature]: Version output always emitted regardless of publish decision#4Marius Storhaug (MariusStorhaug) wants to merge 18 commits into
Marius Storhaug (MariusStorhaug) wants to merge 18 commits into
Conversation
Refactor main.ps1 to always resolve the latest published version and compute a next version. When ShouldPublish is false, a development prerelease version (patch bump + branch name) is produced via the new Get-DevVersion helper function. This ensures Version and FullVersion outputs are never empty, enabling downstream Build-Module to stamp a valid version into the manifest for every CI run. Fixes PSModule/Process-PSModule#348
…thesized decision Non-publishable builds now pass a synthesized prerelease decision (patch bump + prerelease flag) to the existing Get-NextModuleVersion function — no separate function needed. The original decision is preserved for Write-ActionOutput so CreateRelease stays false.
When ShouldPublish is false, Resolve-ReleaseDecision now defaults to CreatePrerelease + PatchRelease so Get-NextModuleVersion always has a valid bump. This removes the synthesized decision from main.ps1 and keeps version strategy logic in one place.
… via PSModule/Invoke-Pester
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
May 27, 2026 19:52
View session
There was a problem hiding this comment.
Pull request overview
Updates the Resolve-PSModuleVersion GitHub Action so it always resolves and emits Version / FullVersion outputs on successful runs, including when no release will be published (non-publish runs now produce a dev prerelease version).
Changes:
- Always resolves latest published version (GitHub releases + PSGallery) and always computes
NewVersion, regardless ofShouldPublish. - Adjusts release-decision/versioning logic to produce a patch-bumped prerelease (with incremental counter) for non-publish runs, and makes
Write-ActionOutput -NewVersionmandatory. - Replaces bespoke workflow-based action tests with Pester tests + data-driven test cases.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/README.md | Removes placeholder test README. |
| tests/Helpers.Tests.ps1 | Adds Pester tests for release decision + version computation behavior. |
| tests/Helpers.Tests.Data.psd1 | Adds data sets driving the new Pester tests. |
| scripts/main.ps1 | Moves version resolution outside ShouldPublish and always computes/emits a version. |
| scripts/Helpers.psm1 | Updates decision/version logic and output emission to ensure outputs are always populated. |
| action.yml | Exposes GH_TOKEN to the action step so gh commands work reliably. |
| .github/workflows/Action-Test.yml | Simplifies CI to run Pester tests via PSModule/Invoke-Pester. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
May 27, 2026 20:38
View session
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
scripts/Helpers.psm1:583
Get-NextPrereleaseNumbercan throw terminating errors (e.g., PSGallery connectivity issues). Since this branch now executes for all non-publishable builds (-not $Decision.ShouldPublish), a transient PSGallery failure would fail otherwise non-publishing PR builds. Consider wrapping the call in try/catch here (with a safe fallback like '001' or GH-only calculation) so version stamping remains reliable.
if ($Configuration.IncrementalPrerelease -or -not $Decision.ShouldPublish) {
$baseVersionString = "$($newVersion.Major).$($newVersion.Minor).$($newVersion.Patch)"
$params = @{
ModuleName = $ModuleName
BaseVersion = $baseVersionString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The action now always emits a valid
VersionandFullVersionoutput, even when no release will be created. Non-publishable builds receive a development prerelease version so downstream jobs always have a version to stamp into the artifact.New: Development prerelease version for non-publishable builds
When
ShouldPublishisfalse, the action now emits a development prerelease version (e.g.1.2.4-mybranch001) instead of empty strings. TheCreateReleaseoutput remainsfalse— downstream jobs continue to use this flag to gate publishing.When
ShouldPublishistrue, behavior is unchanged.Technical Details
ShouldPublishconditional so it always executes.ShouldPublishisfalse, the existingGet-NextModuleVersionis called with a forced patch bump and the branch-based prerelease tag (reusing existingIncrementalPrerelease/DatePrereleaseFormatlogic).Write-ActionOutput'sNewVersionparameter mandatory (always receives a value now).Related issues