Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use api.github.com #191

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions dist/update-known-checksums/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions src/download/download-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/update-known-checksums.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as github from "@actions/github";
import * as core from "@actions/core";

import { OWNER, REPO } from "./utils/constants";
import { GITHUB_COM_API, OWNER, REPO } from "./utils/constants";
import * as semver from "semver";

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

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

const response = await octokit.paginate(octokit.rest.repos.listReleases, {
owner: OWNER,
Expand Down
1 change: 1 addition & 0 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const REPO = "uv";
export const OWNER = "astral-sh";
export const TOOL_CACHE_NAME = "uv";
export const GITHUB_COM_API = "https://api.github.com";
Loading