From 276e678697adeb97fe0dcd4843660f06c8ad1ef2 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Sun, 26 Jan 2025 17:36:52 +0100 Subject: [PATCH] Always use api.github.com The octokit client would default to the URL of enterprise instances and then not be able to find the ruff repo. --- dist/ruff-action/index.js | Bin 1461292 -> 1461450 bytes dist/update-known-checksums/index.js | Bin 1422238 -> 1422314 bytes src/download/download-version.ts | 11 ++++++++--- src/utils/constants.ts | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dist/ruff-action/index.js b/dist/ruff-action/index.js index 5653a628f406053da4e2f371f189c0755cfdb2f4..56293b71614d5efe69cc9fb361d165034ebeb5e3 100644 GIT binary patch delta 226 zcmZ28Bl6VD$c7fi7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj5Eh5Fw zbaWJ|6_OH*Q$ve#tQ3;-^NLFn^Gb^24fWhTLp(yA;+_3{;~fJ$6>2rDxu*Z)XO`YR z@tKGOqbAY%wy%6H@>fg{%{W_y>GS@HOqWWnD9A4=DMq)=RzYdH;3Ot7CME0X7ca1j Pw0ry)+3xXQ^ob7ukta;r delta 91 zcmX>#Gjh$0$c7fi7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj5Eh5Fw urrSOh5!k-wnTQ%Ah{?O1F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj5Eh2&s z1>HSEJVKq~o&9~|9RoZSY!#;0Jrt3euKZA>Rw}ikAit=jSPw&u(saQ|Okzw**3%Vv N1w^-Rc_{MgA^;B6D9Zo< delta 64 zcmaF$JZ#?cu!a`K7N!>F7M2#)7Pc1l7LFFq7OocV7M>Q~7QPn#7J(MQ7NHj5Eh2&s Ur)xbF>7TB|Dt<8 diff --git a/src/download/download-version.ts b/src/download/download-version.ts index 4b9b7c6..fa31010 100644 --- a/src/download/download-version.ts +++ b/src/download/download-version.ts @@ -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"; @@ -84,7 +89,7 @@ export async function resolveVersion( } async function getAvailableVersions(githubToken: string): Promise { - 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, @@ -94,7 +99,7 @@ async function getAvailableVersions(githubToken: string): Promise { } 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, diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 35e0414..ad3a379 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,3 +1,4 @@ export const REPO = "ruff"; export const OWNER = "astral-sh"; export const TOOL_CACHE_NAME = "ruff"; +export const GITHUB_COM_API = "https://api.github.com";