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
This commit is contained in:
Kevin Stillhammer
2024-12-11 18:42:54 +01:00
committed by GitHub
parent 884a30e33c
commit 3460fe1a9a
5 changed files with 18 additions and 10 deletions

View File

@ -2,7 +2,12 @@ import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as path from "node:path";
import { promises as fs } from "node:fs";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import {
GITHUB_COM_API,
OWNER,
REPO,
TOOL_CACHE_NAME,
} from "../utils/constants";
import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum";
import * as github from "@actions/github";
@ -91,7 +96,7 @@ export async function resolveVersion(
}
async function getAvailableVersions(githubToken: string): Promise<string[]> {
const octokit = github.getOctokit(githubToken);
const octokit = github.getOctokit(githubToken, { baseUrl: GITHUB_COM_API });
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
owner: OWNER,
@ -101,7 +106,7 @@ async function getAvailableVersions(githubToken: string): Promise<string[]> {
}
async function getLatestVersion(githubToken: string) {
const octokit = github.getOctokit(githubToken);
const octokit = github.getOctokit(githubToken, { baseUrl: GITHUB_COM_API });
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
owner: OWNER,