Skip to content

🚀 [Feature]: Version input accepts NuGet version ranges#98

Merged
Marius Storhaug (MariusStorhaug) merged 6 commits into
mainfrom
feat/97-nuget-version-range
Jul 9, 2026
Merged

🚀 [Feature]: Version input accepts NuGet version ranges#98
Marius Storhaug (MariusStorhaug) merged 6 commits into
mainfrom
feat/97-nuget-version-range

Conversation

@MariusStorhaug

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

Copy link
Copy Markdown
Member

The Version input 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 Version input

Version accepts the same syntax as Install-PSResource:

Version example Meaning
1.2.3 Exactly 1.2.3
[1.2.3] Exactly 1.2.3
[1.2.0, ] 1.2.0 or newer
(, 2.0.0) Any version lower than 2.0.0
[1.2.0, 2.0.0) 1.2.0 up to but not including 2.0.0

A 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 to Get-InstalledPSResource -Name $Name -Version $Version instead of piping to Where-Object Version -EQ. The redundant Where-Object Prerelease -EQ filter was removed — prerelease handling is governed by the -Prerelease switch passed to Install-PSResource. The retry loop (5 attempts, 10s delay) around Install-PSResource is unchanged.
  • action.yml / README.md: the Version input 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.
  • Tests (.github/workflows/TestWorkflow.yml): added Version [Exact], Version [Bounded range], Version [Minimum range], and Version [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 use Prerelease: ${{ inputs.Prerelease }}, they also exercise the prerelease + range combination when run via Action-Test-Prerelease.yml.
  • Implementation plan progress: all tasks in Support NuGet version range syntax for the Version input #97 are complete.

Backward compatibility: exact-version pins resolve identically; only the unnecessary-reinstall behavior changes.

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 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.ps1 to use Get-InstalledPSResource -Version <range-or-version> (via splatted params) rather than exact string equality filtering.
  • Document version range support in action.yml and README.md, including examples and the “bare version is exact” note.
  • Add CI jobs in .github/workflows/TestWorkflow.yml to 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.

Comment thread src/init.ps1
Comment thread .github/workflows/TestWorkflow.yml Outdated

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 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/TestWorkflow.yml Outdated

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

@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review July 9, 2026 00:13
@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 8083ec1 into main Jul 9, 2026
87 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the feat/97-nuget-version-range branch July 9, 2026 00:17
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.

Support NuGet version range syntax for the Version input

2 participants