🪲 [Fix]: Resolve to the current version on non-PR events (workflow_dispatch, schedule)#10
Merged
Marius Storhaug (MariusStorhaug) merged 2 commits intoJul 11, 2026
Conversation
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 11, 2026 11:37
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the Resolve-PSModuleVersion GitHub Action to support non–pull-request workflow events (e.g., workflow_dispatch, schedule) by treating them as a no-op release decision and resolving to the current published module version instead of throwing.
Changes:
Get-GitHubPullRequestnow returns$null(instead of throwing) when the event payload has nopull_request.scripts/main.ps1now builds a no-op release decision when no PR context exists, keeping the latest published version unchanged.- Adds Pester coverage asserting the no-op decision results in no bump and no prerelease.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/Resolve-PSModuleVersion.Helpers.Tests.ps1 | Adds tests for non-PR behavior keeping the current version unchanged. |
| scripts/Resolve-PSModuleVersion.Helpers.psm1 | Changes non-PR handling in Get-GitHubPullRequest from throwing to returning $null. |
| scripts/main.ps1 | Handles $null PR context by using a no-op decision so non-PR events resolve to the current version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…llRequest coverage
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 11, 2026 12:31
View session
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 11, 2026 12:40
View session
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.
On non–pull-request events (for example
workflow_dispatchandschedule), the action now resolves to the current published version instead of throwing. This is the root-cause fix for thePlanfailures consumers see on scheduled and manual runs.Fixed: no more throw on non–pull-request events
Previously the action required a
pull_requestpayload and threw"...must be run from a pull_request event"on any other event. Because Process-PSModule'sPlanjob runs this on every event, that failed the whole run onschedule/workflow_dispatchfor every consumer.Now, when the event has no
pull_request,Get-GitHubPullRequestreturns$nulland the caller resolves a no-op decision: no bump, no prerelease, nothing published — soGet-NextModuleVersionreturns the current published version unchanged.New: non-PR runs report the current version
There are no PR labels on
workflow_dispatch/schedule, so there's nothing to bump from. The action keeps the latest published version (GitHub Release / PS Gallery), which is what a scheduled or manual re-test should build and test against. For a module that has never been released this floors at0.0.0. Pull-request and merge-to-default-branch behavior is unchanged — labels drive the bump, with patch as the default.Technical Details
scripts/Resolve-PSModuleVersion.Helpers.psm1:Get-GitHubPullRequestreturns$nullon a non-PR event instead of throwing.scripts/main.ps1: builds a no-op release decision (all flagsfalse, empty prerelease) when there is no pull request, otherwise callsResolve-ReleaseDecisionas before.Get-NextModuleVersionthen returnsLatestVersionunchanged.tests/: added cases asserting the no-op decision keeps the current version (1.2.3and the0.0.0floor) with no bump and no prerelease. Full suite: 159 passed, PSScriptAnalyzer clean.Resolve-Versionpin to this version, which lets itsPlan.ymlgate +999.0.0fallback in PR #375 be dropped.