Uh oh!
There was an error while loading. Please reload this page.
🚀 [Feature]: Version input accepts NuGet version ranges - #98
Conversation
There was a problem hiding this comment.
Pull request overview
This PR expands the action’s Version input to support NuGet version range syntax (as understood by PSResourceGet), and updates the “already installed” detection so satisfying installed versions can be reused instead of reinstalled on every run.
Changes:
- Update
src/init.ps1to useGet-InstalledPSResource -Version <range-or-version>(via splatted params) rather than exact string equality filtering. - Document version range support in
action.ymlandREADME.md, including examples and the “bare version is exact” note. - Add CI jobs in
.github/workflows/TestWorkflow.ymlto exercise exact versions, bounded/minimum ranges, and the “already installed” reuse behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/init.ps1 | Adjusts installed-version detection to honor PSResourceGet version-range semantics. |
README.md | Documents range syntax and provides a usage examples table for Version. |
action.yml | Updates the Version input description to explicitly accept version ranges. |
.github/workflows/TestWorkflow.yml | Adds workflow jobs validating exact and range behaviors plus reuse of satisfying installs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Uh oh!
There was an error while loading. Please reload this page.
The
Versioninput now accepts a NuGet version range in addition to an exact version, so a workflow can pin a compatible window (for example[1.2.0, 2.0.0)) instead of a single build. Pinning an exact version keeps working exactly as before, and a version that is already installed and satisfies the request is no longer reinstalled on every run.New: NuGet version ranges for the
VersioninputVersionaccepts the same syntax asInstall-PSResource:Versionexample1.2.31.2.3[1.2.3]1.2.3[1.2.0, ]1.2.0or newer(, 2.0.0)2.0.0[1.2.0, 2.0.0)1.2.0up to but not including2.0.0A bare version is treated as an exact version (not a minimum), so existing pins are unaffected. PSResourceGet resolves a range to the lowest satisfying version.
Fixed: a satisfying version is reused instead of reinstalled
Previously, supplying anything other than an exact version caused the module to be reinstalled on every run: the already-installed check compared the raw input to installed versions with exact string equality, which never matches a range. The check now honors ranges, so an already-installed version that satisfies the request is reused.
Technical Details
src/init.ps1: the already-installed lookup now passes the value toGet-InstalledPSResource -Name $Name -Version $Versioninstead of piping toWhere-Object Version -EQ. The redundantWhere-Object Prerelease -EQfilter was removed — prerelease handling is governed by the-Prereleaseswitch passed toInstall-PSResource. The retry loop (5 attempts, 10s delay) aroundInstall-PSResourceis unchanged.action.yml/README.md: theVersioninput is documented as accepting an exact version or a NuGet version range, with an examples table and a note that a bare version is exact..github/workflows/TestWorkflow.yml): addedVersion [Exact],Version [Bounded range],Version [Minimum range], andVersion [Already installed]jobs (Linux; version resolution is OS-independent). Written test-first — the already-installed job failed on the unfixed code (two installed versions) and passes after the fix. Because these jobs usePrerelease: ${{ inputs.Prerelease }}, they also exercise the prerelease + range combination when run viaAction-Test-Prerelease.yml.Backward compatibility: exact-version pins resolve identically; only the unnecessary-reinstall behavior changes.