Skip to content

Commit 3460fe1

Browse files
authored
Always use api.github.com (#191)
The octokit client would default to the URL of enterprise instances and then not be able to find the uv repo. Closes: #188
1 parent 884a30e commit 3460fe1

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

dist/setup/index.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/update-known-checksums/index.js

+3-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/download/download-version.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import * as core from "@actions/core";
22
import * as tc from "@actions/tool-cache";
33
import * as path from "node:path";
44
import { promises as fs } from "node:fs";
5-
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
5+
import {
6+
GITHUB_COM_API,
7+
OWNER,
8+
REPO,
9+
TOOL_CACHE_NAME,
10+
} from "../utils/constants";
611
import type { Architecture, Platform } from "../utils/platforms";
712
import { validateChecksum } from "./checksum/checksum";
813
import * as github from "@actions/github";
@@ -91,7 +96,7 @@ export async function resolveVersion(
9196
}
9297

9398
async function getAvailableVersions(githubToken: string): Promise<string[]> {
94-
const octokit = github.getOctokit(githubToken);
99+
const octokit = github.getOctokit(githubToken, { baseUrl: GITHUB_COM_API });
95100

96101
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
97102
owner: OWNER,
@@ -101,7 +106,7 @@ async function getAvailableVersions(githubToken: string): Promise<string[]> {
101106
}
102107

103108
async function getLatestVersion(githubToken: string) {
104-
const octokit = github.getOctokit(githubToken);
109+
const octokit = github.getOctokit(githubToken, { baseUrl: GITHUB_COM_API });
105110

106111
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
107112
owner: OWNER,

src/update-known-checksums.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as github from "@actions/github";
22
import * as core from "@actions/core";
33

4-
import { OWNER, REPO } from "./utils/constants";
4+
import { GITHUB_COM_API, OWNER, REPO } from "./utils/constants";
55
import * as semver from "semver";
66

77
import { updateChecksums } from "./download/checksum/update-known-checksums";
@@ -10,7 +10,7 @@ async function run(): Promise<void> {
1010
const checksumFilePath = process.argv.slice(2)[0];
1111
const github_token = process.argv.slice(2)[1];
1212

13-
const octokit = github.getOctokit(github_token);
13+
const octokit = github.getOctokit(github_token, { baseUrl: GITHUB_COM_API });
1414

1515
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
1616
owner: OWNER,

src/utils/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const REPO = "uv";
22
export const OWNER = "astral-sh";
33
export const TOOL_CACHE_NAME = "uv";
4+
export const GITHUB_COM_API = "https://api.github.com";

0 commit comments

Comments
 (0)