5
0
mirror of https://github.com/astral-sh/setup-uv.git synced 2025-12-23 11:01:03 +00:00

Add resolution-strategy input to support oldest compatible version selection (#631)

Adds a new `resolution-strategy` input that allows users to choose
between installing the highest (default) or lowest compatible version
when resolving version ranges.
This commit is contained in:
Copilot
2025-10-11 21:02:04 +02:00
committed by GitHub
parent a5129e99f4
commit 9c6b5e9fb5
8 changed files with 136 additions and 11 deletions

View File

@@ -27,6 +27,7 @@ export const githubToken = core.getInput("github-token");
export const manifestFile = getManifestFile();
export const addProblemMatchers =
core.getInput("add-problem-matchers") === "true";
export const resolutionStrategy = getResolutionStrategy();
function getVersionFile(): string {
const versionFileInput = core.getInput("version-file");
@@ -186,3 +187,16 @@ function getManifestFile(): string | undefined {
}
return undefined;
}
function getResolutionStrategy(): "highest" | "lowest" {
const resolutionStrategyInput = core.getInput("resolution-strategy");
if (resolutionStrategyInput === "lowest") {
return "lowest";
}
if (resolutionStrategyInput === "highest" || resolutionStrategyInput === "") {
return "highest";
}
throw new Error(
`Invalid resolution-strategy: ${resolutionStrategyInput}. Must be 'highest' or 'lowest'.`,
);
}