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:
@@ -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'.`,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user