Respect the mirror setting when selecting the version manifest (#1164)

Select the manifest source from the action inputs and keep version
resolution separate from archive downloads. Fetch the built-in manifest
directly from GitHub when the Astral mirror is disabled.

Fixes: #1140

Based on the work of @Rudra-G-23 in
https://github.com/astral-sh/setup-uv/pull/1152

Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Kevin StillhammerandAmp authored and GitHub committed 2026-12-02 11:40:15 +01:00
1 parent 521745f16c
commit 36300bab3f
19 files changed
+1637 -1647

No files matched your search

+35 -1
View File
@@ -108,11 +108,45 @@ describe("loadInputs", () => {
expect(inputs.pythonArch).toBe("");
expect(inputs.exportPythonArch).toBe(false);
expect(inputs.venvPath).toBe("/workspace/.venv");
expect(inputs.manifestFile).toBeUndefined();
expect(inputs.requireChecksums).toBe(false);
expect(inputs.resolutionStrategy).toBe("highest");
});
it.each([
[
"true",
{
custom: false,
fallbackUrl:
"https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
newestFirst: true,
url: "https://releases.astral.sh/github/versions/main/v1/uv.ndjson",
},
],
[
"false",
{
custom: false,
newestFirst: true,
url: "https://raw.githubusercontent.com/astral-sh/versions/main/v1/uv.ndjson",
},
],
])("selects the official source when the mirror is %s", (mirror, source) => {
mockInputs["download-from-astral-mirror"] = mirror;
expect(loadInputs().manifestSource).toStrictEqual(source);
});
it("uses an explicit manifest source even with the mirror enabled", () => {
mockInputs["download-from-astral-mirror"] = "true";
mockInputs["manifest-file"] = "https://example.com/custom.ndjson";
expect(loadInputs().manifestSource).toStrictEqual({
custom: true,
newestFirst: false,
url: "https://example.com/custom.ndjson",
});
});
it("loads require-checksums", () => {
mockInputs["require-checksums"] = "true";
expect(loadInputs().requireChecksums).toBe(true);