Skip to content

Commit 0e0f4bf

Browse files
authored
feat: support custom github url (#414)
Fix #344
1 parent 71bb882 commit 0e0f4bf

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ inputs:
1818
checksum:
1919
description: "The checksum of the uv version to install"
2020
required: false
21+
server-url:
22+
description: "The server url to use when downloading uv"
23+
required: false
24+
default: "https://github.com"
2125
github-token:
2226
description:
2327
"Used to increase the rate limit when retrieving versions and downloading uv."

dist/save-cache/index.js

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js

Lines changed: 8 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/download/download-version.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function tryGetFromToolCache(
2424
}
2525

2626
export async function downloadVersion(
27+
serverUrl: string,
2728
platform: Platform,
2829
arch: Architecture,
2930
version: string,
@@ -36,7 +37,7 @@ export async function downloadVersion(
3637
if (platform === "pc-windows-msvc") {
3738
extension = ".zip";
3839
}
39-
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
40+
const downloadUrl = `${serverUrl}/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
4041
core.info(`Downloading uv from "${downloadUrl}" ...`);
4142

4243
const downloadPath = await tc.downloadTool(

src/setup-uv.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
toolDir,
2626
version as versionInput,
2727
workingDirectory,
28+
serverUrl,
2829
} from "./utils/inputs";
2930
import * as exec from "@actions/exec";
3031
import fs from "node:fs";
@@ -95,6 +96,7 @@ async function setupUv(
9596
}
9697

9798
const downloadVersionResult = await downloadVersion(
99+
serverUrl,
98100
platform,
99101
arch,
100102
resolvedVersion,

src/utils/inputs.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export const ignoreEmptyWorkdir =
1717
core.getInput("ignore-empty-workdir") === "true";
1818
export const toolBinDir = getToolBinDir();
1919
export const toolDir = getToolDir();
20+
export const serverUrl = getServerUrl();
2021
export const githubToken = core.getInput("github-token");
2122

2223
function getEnableCache(): boolean {
@@ -84,3 +85,7 @@ function expandTilde(input: string): string {
8485
}
8586
return input;
8687
}
88+
89+
function getServerUrl(): string {
90+
return core.getInput("server-url");
91+
}

0 commit comments

Comments
 (0)