Skip to content

🪲 [Fix]: Version previews reflect the version-bump label regardless of release type#9

Merged
Marius Storhaug (MariusStorhaug) merged 2 commits into
mainfrom
feat/always-evaluate-version-labels
Jul 10, 2026
Merged

🪲 [Fix]: Version previews reflect the version-bump label regardless of release type#9
Marius Storhaug (MariusStorhaug) merged 2 commits into
mainfrom
feat/always-evaluate-version-labels

Conversation

@MariusStorhaug

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Jul 10, 2026

Copy link
Copy Markdown
Member

Version-bump labels (major, minor, patch) are now always evaluated when resolving a module version, so the version a run reports always matches what those labels would produce. Previously, on pull_request events (ReleaseType = None) the resolver ignored the labels and always previewed a patch prerelease, which made pull request previews misleading. ReleaseType — and the prerelease label that drives it — now only controls whether and how a version is published, never the size of the version increment.

Fixed: Pull request previews now reflect the version-bump label

The resolved version on a non-publishing run now reflects the bump label instead of always showing a patch. Publishing behavior is unchanged — only the previewed version changes for label combinations that were previously never evaluated.

Situation Before After
Open PR, minor label, no prerelease label x.y.z+1 patch preview x.(y+1).0 minor preview (still not published)
Open PR, major label, no prerelease label x.y.z+1 patch preview (x+1).0.0 major preview (still not published)
PR with prerelease label publishes a prerelease unchanged — prerelease still gates publishing
Merge to main with minor label minor release unchanged

Technical Details

  • scripts/Resolve-PSModuleVersion.Helpers.psm1 (Resolve-ReleaseDecision): the major/minor/patch label evaluation was moved out from behind the if ($shouldPublish) guard so it always runs. When no bump label is present and AutoPatching is disabled, the run still previews a patch version but sets ShouldPublish = $false. Any run that is not a published full release continues to be surfaced as a prerelease (CreatePrerelease = $true).
  • tests/Resolve-PSModuleVersion.Helpers.Tests.Data.psd1: added ReleaseDecision and EndToEnd cases for None + minor and None + major previews. All existing ReleaseDecision, EndToEnd, and NextModuleVersion cases are unchanged.
  • Validation: 157/157 Pester tests pass; PSScriptAnalyzer clean.
  • E2E: MariusStorhaug/MariusTestModule PR #34 (labelled Minor, no prerelease label) now previews v0.5.0-teste2eimporttestdata001 with ShouldPublish = False (previously v0.4.2-…).
  • Relates to PSModule/Process-PSModule#378.

The major/minor/patch label evaluation was gated behind ShouldPublish, so on a pull_request event (ReleaseType None) the resolver ignored the labels and always previewed a patch prerelease. Now the bump labels are always evaluated, so the resolved version reflects what WOULD be created; ReleaseType (and the prerelease label that drives it) only controls whether and how we publish. Adds ReleaseDecision + EndToEnd tests for None + minor/major previews. All existing cases are unchanged (152/152 pass).
Copilot AI review requested due to automatic review settings July 10, 2026 20:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the release decision logic so major/minor/patch bump labels are always evaluated when resolving the next version, even when ReleaseType=None (e.g., pull_request previews). This ensures previews reflect the same increment that would be used on a publish run; ReleaseType only governs publishing behavior.

Changes:

  • Removed the $shouldPublish gate around version-bump label evaluation in Resolve-ReleaseDecision.
  • Added test data cases covering ReleaseType=None + version-bump labels (with prerelease preview behavior).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scripts/Resolve-PSModuleVersion.Helpers.psm1 Always compute major/minor/patch bump decisions from labels; keep publishing gated by ReleaseType/ShouldPublish.
tests/Resolve-PSModuleVersion.Helpers.Tests.Data.psd1 Adds new ReleaseType=None preview scenarios to test data (ReleaseDecision + NextModuleVersion/EndToEnd datasets).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/Resolve-PSModuleVersion.Helpers.Tests.Data.psd1
Copilot review noted the description claims a None+major EndToEnd/NextModuleVersion case but only None+minor was present. Adds the missing major preview case (1.0.1 -> v2.0.0-featnonemajor001, ShouldPublish=false) so the new label-always-evaluated behavior is covered end-to-end for major bumps too.
Copilot AI review requested due to automatic review settings July 10, 2026 21:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title Always evaluate version-bump labels regardless of ReleaseType 🪲 [Fix]: Version previews reflect the version-bump label regardless of release type Jul 10, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 8d1dac7 into main Jul 10, 2026
18 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the feat/always-evaluate-version-labels branch July 10, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants