Repository navigation
Match version prefixes only at component boundaries - #988
Merged
Merged
Conversation
A partial version such as mswin-3.4.1 resolved to 3.4.13 and jruby-9.4.1 to 9.4.16.0, because any version starting with the input string was accepted. Require the prefix to end between components, so these fail as unknown or pick 9.4.1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Require the partial version to be followed by a . or - separator instead of checking for a digit on both sides of the prefix end. A prefix ending inside a component, such as 3.0.0-preview, no longer matches. Co-Authored-By: Claude <noreply@anthropic.com>
eregon
approved these changes
Nov 28, 2026
eregon
left a comment
Member
There was a problem hiding this comment.
Thanks, I tweaked the condition for readability.
Another idea would be to use /\b/:
const prefix = new RegExp(`^${RegExp.escape(parsedVersion)}\\b`)
const matches = v => prefix.test(v)which seems nice but RegExp.escape is Node 24+ and I'm not sure all usages of the action use node 24 yet.
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.
A version that does not exist resolved to a different release sharing its leading characters:
mswin-3.4.1installed 3.4.13,mswin-4.0.1installed 4.0.10, andjruby-9.4.1installed 9.4.16.0 instead of 9.4.1.0, as reported in #979 (comment).A partial version now matches only when it ends between version components, so
3.4.1no longer matches3.4.13. Engine-only and short versions such asruby,jruby,3.4and9.4still resolve to the latest release, and3.4.0-previewstyle prefixes are unchanged. A plainparsedVersion + '.'check would have broken the engine-only case, because the empty version would then match nothing.Across every version list, only these inputs change:
mswin-3.4.1,mswin-4.0.1,jruby-9.3.1,jruby-9.4.1, and2.2.1on Linux, which now fails instead of installing 2.2.10.Generated with Claude Code