Skip to content

🪲 [Fix]: Resolve to the current version on non-PR events (workflow_dispatch, schedule)#10

Merged
Marius Storhaug (MariusStorhaug) merged 2 commits into
mainfrom
fix/non-pr-events-use-current-version
Jul 11, 2026
Merged

🪲 [Fix]: Resolve to the current version on non-PR events (workflow_dispatch, schedule)#10
Marius Storhaug (MariusStorhaug) merged 2 commits into
mainfrom
fix/non-pr-events-use-current-version

Conversation

@MariusStorhaug

Copy link
Copy Markdown
Member

On non–pull-request events (for example workflow_dispatch and schedule), the action now resolves to the current published version instead of throwing. This is the root-cause fix for the Plan failures consumers see on scheduled and manual runs.

Fixed: no more throw on non–pull-request events

Previously the action required a pull_request payload and threw "...must be run from a pull_request event" on any other event. Because Process-PSModule's Plan job runs this on every event, that failed the whole run on schedule / workflow_dispatch for every consumer.

Now, when the event has no pull_request, Get-GitHubPullRequest returns $null and the caller resolves a no-op decision: no bump, no prerelease, nothing published — so Get-NextModuleVersion returns 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 at 0.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-GitHubPullRequest returns $null on a non-PR event instead of throwing.
  • scripts/main.ps1: builds a no-op release decision (all flags false, empty prerelease) when there is no pull request, otherwise calls Resolve-ReleaseDecision as before. Get-NextModuleVersion then returns LatestVersion unchanged.
  • tests/: added cases asserting the no-op decision keeps the current version (1.2.3 and the 0.0.0 floor) with no bump and no prerelease. Full suite: 159 passed, PSScriptAnalyzer clean.
  • Follow-up: once released, Process-PSModule bumps its Resolve-Version pin to this version, which lets its Plan.yml gate + 999.0.0 fallback in PR #375 be dropped.

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 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-GitHubPullRequest now returns $null (instead of throwing) when the event payload has no pull_request.
  • scripts/main.ps1 now 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.

Comment thread scripts/Resolve-PSModuleVersion.Helpers.psm1
Comment thread tests/Resolve-PSModuleVersion.Helpers.Tests.ps1
Copilot AI review requested due to automatic review settings July 11, 2026 12:30

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 3 out of 3 changed files in this pull request and generated no new comments.

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 3 out of 3 changed files in this pull request and generated no new comments.

@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 6a59a88 into main Jul 11, 2026
19 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the fix/non-pr-events-use-current-version branch July 11, 2026 13:21
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