Skip to content

🪲 [Fix]: Plan no longer fails on schedule/workflow_dispatch (skip version resolution on non-PR events)#375

Open
Marius Storhaug (MariusStorhaug) wants to merge 2 commits into
mainfrom
fix/plan-resolve-version-non-pr-events
Open

🪲 [Fix]: Plan no longer fails on schedule/workflow_dispatch (skip version resolution on non-PR events)#375
Marius Storhaug (MariusStorhaug) wants to merge 2 commits into
mainfrom
fix/plan-resolve-version-non-pr-events

Conversation

@MariusStorhaug

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

Copy link
Copy Markdown
Member

The Plan job no longer fails on schedule, workflow_dispatch, or other non–pull-request events, and those runs now complete their full build/test cycle green with no release. Releases and prereleases are unchanged.

Fixed: non–pull-request runs (schedule / workflow_dispatch)

Since v6.1.0 (which moved version resolution into Plan), two things broke non-PR runs:

  1. Resolve-Version ran on every event and threw "...must be run from a pull_request event", failing Plan (and therefore the whole run, since every job needs: Plan).
  2. Even once Plan was fixed, the module-local tests failed with "Tests did not execute": the Test-ModuleLocal prescript imports the built module with -RequiredVersion '<Module.Version>', but on non-PR events Module.Version is empty (no PR labels to resolve from), producing -RequiredVersion '' — a binding error that prevented the module from importing.

Both are fixed:

  • Plan.yml: Resolve-Version is gated to pull_request events. On non-PR events ReleaseType is already None and Run.PublishModule is already false, and Enrich-Settings falls back to safe empty version defaults.
  • Test-ModuleLocal.yml: the prescript's -RequiredVersion now falls back to 999.0.0 when Module.Version is empty, matching the placeholder Build-Module already uses. So on non-PR runs the module is built as 999.0.0 and imported as 999.0.0 — consistent, and tests execute.

The release model is unchanged and matches the intended behavior:

  • Default → no release (regular PRs, schedule, workflow_dispatch).
  • Merge to the default branch → release.
  • Open PR with the prerelease label → prerelease.

Technical Details

  • .github/workflows/Plan.yml: add if: github.event_name == 'pull_request' to the Resolve-Version step (with an explanatory comment). No change to the shared Resolve-PSModuleVersion / Get-PSModuleSettings actions.
  • .github/workflows/Test-ModuleLocal.yml: -RequiredVersion '${{ ...Module.Version != '' && ...Module.Version || '999.0.0' }}', mirroring the fallback already in Build-Module.yml.
  • Validated on the fix branch:
    • workflow_dispatch self-test run: completed successfullyPlan passes and all Test-ModuleLocal jobs (Test-Environment + Test-PSModuleTest, Linux/macOS/Windows) pass, with Publish skipped (no release). Previously this failed at Plan.
    • PR self-test (pull_request): Resolve-Version still runs and succeeds — version resolution / release path intact.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a regression where the reusable workflow’s Plan job failed on non–pull-request events (e.g., schedule, workflow_dispatch) by ensuring version resolution only runs when PR context exists.

Changes:

  • Gate the Resolve-Version step to run only on pull_request events.
  • Add an in-file comment explaining the PR-context requirement and why skipping is safe for non-PR runs.
  • Preserve downstream behavior by allowing Enrich-Settings to consume empty outputs and default ReleaseType/CreateRelease appropriately.

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

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
POWERSHELL Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copilot AI review requested due to automatic review settings July 10, 2026 10:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 1 comment.

Comment on lines +89 to +93
# bump and the prerelease name). Skip it on non-PR events (schedule, workflow_dispatch,
# push): there ReleaseType is 'None', nothing is published, and Enrich-Settings falls
# back to safe empty defaults. Without this gate the action throws on non-PR events and
# fails the whole run. Fixes #373.
if: github.event_name == 'pull_request'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plan job fails on schedule/workflow_dispatch: Resolve-Version requires a pull_request event (v6.1.0+ regression)

2 participants