Uh oh!
There was an error while loading. Please reload this page.
🚀 [Minor]: Add optional GUID identity pinning to Pester selection - #73
Conversation
New Action-Test job runs a test whose #Requires pins Pester by module identity (GUID) plus version, and asserts the loaded module Guid and Version. Wired into CatchJob needs, aggregated env vars, and Test-ActionResults.ps1. Related to #68.
There was a problem hiding this comment.
Pull request overview
Adds a new CI “Action-Test” job and matching expected-results entry to validate that Pester can be pinned not just by version, but also by module identity (GUID) via a test file #Requires -Modules constraint. This extends the existing version-constraint coverage with a “safety-net” scenario aligned with the GUID pinning discussion in #68.
Changes:
- Added a new Pester test suite that uses
#Requires -ModuleswithRequiredVersion+GUIDand asserts the loaded module’sGuidandVersion. - Added a new
ActionTestPesterGuidPinjob toAction-Test.ymland wired it into theCatchJobaggregation. - Added the new job’s expected outcome to
tests/Test-ActionResults.ps1.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Test-ActionResults.ps1 | Adds expected results for the new “Pester GUID Pin” Action-Test job. |
| tests/4-PesterVersionConstraints/PesterGuidPin/PesterVersion.Tests.ps1 | New test demonstrating #Requires GUID pinning and validating loaded Pester identity/version. |
| .github/workflows/Action-Test.yml | Adds a new CI job to run the GUID-pin test and exports its results to the aggregator job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
New Guid action input validates the loaded Pester module GUID after install (via Import-Module identity check), failing fast at init when a different module named Pester is present. Wired through action.yml, init.ps1 and exec.ps1. The existing PesterGuidPin job now also passes Guid (validating at both install and #Requires layers), and a new PesterGuidMismatch job asserts a wrong GUID fails the action. Documented in README. Related to #68.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Positive counterpart to PesterGuidMismatch: passes the correct Guid via the action input with a version-only (no GUID) #Requires, isolating and proving the matching Guid input lets the run proceed and the tests pass. Wired into CatchJob needs, env vars, and Test-ActionResults.ps1.
Uh oh!
There was an error while loading. Please reload this page.
Address Copilot review on PR #73: validate the exact module returned by Import-Module -PassThru (not the highest loaded version) so a side-by-side load cannot mask a mismatch; parse the Guid with [guid]::TryParse for a clear error on malformed input. The PesterGuidPin and PesterGuidMatch tests now select the expected version explicitly instead of the highest loaded.
Uh oh!
There was an error while loading. Please reload this page.
Address Copilot review on PR #73: the fallback used Get-PSResource, which is the installed-resource query (alias of Get-InstalledPSResource; the gallery cmdlet is Find-PSResource). Switched to the explicit Get-InstalledPSResource so the installed-only intent is unambiguous and to avoid the alias.
Uh oh!
There was an error while loading. Please reload this page.
Address Copilot review on PR #73: add ActionTestPesterGuidMismatch to CatchJob.needs so the aggregate/step-summary runs only after the negative job completes. The negative job stays self-asserting (a wrong Guid aborts the action at init, leaving empty Executed/Result that do not fit the success-oriented results table). Clarified the Test-ActionResults description accordingly.
Uh oh!
There was an error while loading. Please reload this page.
Adds an optional
Guidinput so a workflow can pin Pester by module identity (GUID), validated at install time. Combined with a#RequiresGUID pin in test files, identity is validated the whole way — on the developer's machine and in CI at discovery, and now also in CI at the action's install step (shifted left, one clear failure point).Added:
Guidinput for module-identity pinningThe optional
Guidinput pins Pester by module identity. After resolving and installing the version, the action validates the loaded module's GUID and fails fast if it does not match — guarding against a different module namedPesteron the runner'sPSModulePath.Validation now happens at every layer:
#Requires -Modules @{ ...; GUID = ... }in test files.Guidinput (earliest single point of failure).Technical Details
action.yml: new optionalGuidinput, passed to both the init and exec phases viaPSMODULE_INVOKE_PESTER_INPUT_Guid.Install-PSResourceWithRetry: new-Guidparameter; after import, it validates the loaded module'sGuidand throws a clear error on mismatch.Install-PSResourcecannot select by GUID (gallery identity is name + version), so identity is enforced at import.init.ps1/exec.ps1: read the input and pass-Guidthrough.PesterGuidPinpins via both theGuidinput and#Requires(validating the whole way).PesterGuidMatchpins via theGuidinput only (version-only#Requires), asserting a matching GUID lets the run succeed.PesterGuidMismatchpasses a wrongGuidand asserts the action fails.Loaded 'Pester' does not match the required GUID ....This closes the last remaining item on #68 — the version-selection core shipped in #71 (v5.0.0), and this adds the optional GUID identity pin.