MCPcopy
hub / github.com/actions/setup-java / isVersionSatisfies

Function isVersionSatisfies

src/util.ts:57–77  ·  view source on GitHub ↗
(range: string, version: string)

Source from the content-addressed store, hash-verified

55}
56
57export function isVersionSatisfies(range: string, version: string): boolean {
58 // Some distributions (e.g. JetBrains Runtime) publish 4-segment versions
59 // like '17.0.8.1+1080.1' that semver rejects. If the candidate version
60 // isn't valid semver, it can't match — bail out rather than letting
61 // compareBuild / satisfies throw.
62 if (!semver.valid(version)) {
63 return false;
64 }
65
66 if (semver.valid(range)) {
67 // if full version with build digit is provided as a range (such as '1.2.3+4')
68 // we should check for exact equal via compareBuild
69 // since semver.satisfies doesn't handle 4th digit
70 const semRange = semver.parse(range);
71 if (semRange && semRange.build?.length > 0) {
72 return semver.compareBuild(range, version) === 0;
73 }
74 }
75
76 return semver.satisfies(version, range);
77}
78
79export function getToolcachePath(
80 toolName: string,

Callers 11

findInToolcacheFunction · 0.90
util.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected