🪲 [Fix]: Only resolve a prerelease for open pull requests#11
Open
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Open
🪲 [Fix]: Only resolve a prerelease for open pull requests#11Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Marius Storhaug (MariusStorhaug) wants to merge 1 commit into
Conversation
…erge/push to the default branch)
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 18:04
View session
There was a problem hiding this comment.
Pull request overview
This PR adjusts version resolution so prerelease versions are only produced while a pull request is open, preventing “prerelease-on-merge” outcomes when changes land on the default branch.
Changes:
- Extend
Get-GitHubPullRequestto surface anIsOpenflag derived frompull_request.state. - Update
Resolve-ReleaseDecisionto resolve prereleases only for open PRs; merged/closed PRs (and default-branch pushes) never resolve to a prerelease and instead either produce a stable release or keep the current version. - Update/expand Pester test data and cases to explicitly pass
IsOpenand cover merged-vs-open behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Resolve-PSModuleVersion.Helpers.Tests.ps1 | Updates PR-object construction to include IsOpen and adds Get-GitHubPullRequest assertions for open vs closed PR events. |
| tests/Resolve-PSModuleVersion.Helpers.Tests.Data.psd1 | Refreshes/extends test matrices to include IsOpen and validates “no prerelease after merge” scenarios. |
| scripts/Resolve-PSModuleVersion.Helpers.psm1 | Implements IsOpen detection and gates prerelease resolution on open PRs within Resolve-ReleaseDecision. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ($result.Labels -join ',') | Should -Be 'patch,prerelease' | ||
| $result.IsOpen | Should -BeTrue | ||
| } | ||
|
|
13 tasks
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.
Note
Role: stopgap. This is the small, architecture-independent guard for the reported bug (a prerelease resolved on merge to the default branch). It holds the invariant "a prerelease is only ever resolved for an open PR" regardless of how releases are triggered, so it survives the planned redesign.
The full fix — moving stable releases to a
push-to-maintrigger and consolidating the framework scripts into the PSMA action library — is tracked in PSModule/Process-PSModule#384 (builds on #84). This PR is safe to merge now and does not block that work.Summary Resolve a prerelease only while a pull request is open. A change that has landed on the default branch — a merged/closed
pull_requestevent, or a push to the default branch (which the workflow treats the same as a merged PR) — must never resolve to a prerelease. It resolves to a stable release when the merge warrants one, otherwise it keeps the current version. ## WhyResolve-ReleaseDecisionpreviously ended with:powershell # Anything that is not a published full release is surfaced as a prerelease if (-not $shouldPublish) { $createPrerelease = $true }That fired regardless of whether the run was an open PR or a merge. A merged PR that does not produce a full release (ReleaseType='None'— e.g. the changed files do not matchImportantFilePatterns, a merge to a non-default branch, an ignore/NoReleaselabel, or no bump label with AutoPatching off) therefore resolved to a prerelease on merge. Because the Plan job stamps the built artifact with this version, that prerelease could be built/published from a merge — it should never exist once the merge decision is made. Prereleases are the mechanism that keeps an in-review artifact from ever masquerading as a stable release. That guarantee only makes sense while the PR is open. ## What changed -Get-GitHubPullRequestnow surfacesIsOpen(pull_request.state -eq 'open'), defaulting to not-open when state is absent so we never accidentally prerelease. -Resolve-ReleaseDecisionbranches onIsOpen: - Open PR → always carries a prerelease tag (published prerelease forReleaseType='Prerelease', otherwise a non-published preview). An ignore label only suppresses publishing; the reviewed artifact stays a prerelease. - Merged/closed PR or push to the default branch → never a prerelease. A full release when the merge warrants one (ReleaseType='Release'with a determinable bump), otherwise the current version is kept unchanged. ### Behavior matrix | Trigger | Before | After | | --- | --- | --- | | Open PR (no prerelease label) | prerelease preview | prerelease preview (unchanged) | | Open PR (prerelease label) | published prerelease | published prerelease (unchanged) | | Merged PR → default, releasable | stable release | stable release (unchanged) | | Merged PR → default,ReleaseType='None'| prerelease | current version (no prerelease) | | Merged PR, ignore/NoReleaselabel | prerelease | current version (no prerelease) | | Merged PR, no bump + AutoPatching off | prerelease | current version (no prerelease) | | Push to default branch | current version | current version (unchanged) | ## Tests - All 188 Pester tests pass. - EveryResolve-ReleaseDecisionand end-to-end case now carries an explicitIsOpen. - Added cases locking the fix: a merged PR withReleaseType='None'keeps the current version; a merged PR with an ignore label / no bump keeps the current version; an open PR with an ignore label still previews a prerelease. ## Rollout After this releases (patch → v1.1.6), bump the pin inPSModule/Process-PSModule.github/workflows/Plan.yml(Resolve-PSModuleVersion@…), which flows to consumers on their nextProcess-PSModulebump. Reported from: https://github.com/PSModule/GoogleFonts/actions/runs/29202094727