🩹 [Patch]: Ensure the selected GitHub module version is the one loaded#100
Open
Marius Storhaug (MariusStorhaug) wants to merge 5 commits into
Open
🩹 [Patch]: Ensure the selected GitHub module version is the one loaded#100Marius Storhaug (MariusStorhaug) wants to merge 5 commits into
Marius Storhaug (MariusStorhaug) wants to merge 5 commits into
Conversation
…sions init.ps1 now resolves the exact installed version satisfying the Version input, removes any already-loaded GitHub module versions from the session, and imports the resolved version with -RequiredVersion -Global — so the user script uses the selected version instead of whatever PowerShell would auto-load from PSModulePath.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 11, 2026 17:24
View session
There was a problem hiding this comment.
Pull request overview
This PR makes the GitHub PowerShell module import deterministic by resolving an installed version that matches the requested Version input, unloading any already-loaded GitHub module, and then importing the resolved version with -RequiredVersion so subsequent scripts in the action run against the intended module version.
Changes:
- Resolve the newest installed GitHub module version that satisfies the requested
Versionconstraint. - Remove any already-loaded GitHub module from the session before importing.
- Import the resolved version explicitly via
Import-Module -RequiredVersion ... -Force -Global.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 09:55
View session
…loaded instances Per PR review: resolution now excludes prerelease versions when Prerelease is false and adds a stable-wins tie-breaker (so a Prerelease:false run never imports an installed prerelease, and stable wins at equal base version); and 'Get-Module -Name \ -All | Remove-Module' removes every loaded instance before import.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:00
View session
…r error Filter/sort on the 'Prerelease' string instead of IsPrerelease; add -ErrorAction Stop to the final Import-Module so a failed load stops the run; and render 'latest' in the throw message when no Version was requested (matching the moduleStatus display).
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:21
View session
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:24
View session
…stable request When Prerelease is false, exclude prereleases from the already-installed check so a machine with only prerelease builds installed still installs a stable version instead of failing resolution.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:31
View session
…matches Normalize the already-installed set to \ when the (prerelease-filtered) query returns nothing, so the '-not' install guard and the '\ -ne' moduleStatus check both retain their original meaning instead of an empty array reading as 'installed'.
Copilot started reviewing on behalf of
Marius Storhaug (MariusStorhaug)
July 12, 2026 10:36
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.
Makes the GitHub module version selected through the
Version/Prereleaseinputs the version that is actually installed, loaded, and used by the script.Fixed: the selected GitHub module version is the one loaded
init.ps1now:Prerelease— aPrerelease: falserun never resolves to an installed prerelease, with a stable-wins tie-breaker at equal base version (uses the PSResourceGetPrereleasestring).Get-Module -Name $Name -All | Remove-Module) so no side-by-side version remains.-RequiredVersion … -Force -Global -ErrorAction Stop, so every subsequent command (info.ps1, the user script,clean.ps1) uses the selected version and a failed load stops the run.Previously
init.ps1skipped importing when any version was already loaded and used an unconstrainedImport-Module, so PowerShell could auto-load a different (for example newer, preinstalled) version, defeating the requested pin.Technical Details
src/init.ps1: prerelease-aware resolution, remove-all-instances,-RequiredVersion/-Global/-ErrorAction Stopimport, and a clearer error (renderslatestwhen no version was requested).