mirror of
https://github.com/astral-sh/ruff-action.git
synced 2026-05-20 07:50:13 +02:00
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.
This commit is contained in:
+4
-3
@@ -34663,7 +34663,7 @@ async function resolveVersion(versionInput, githubToken) {
|
|||||||
return resolvedVersion;
|
return resolvedVersion;
|
||||||
}
|
}
|
||||||
async function getAvailableVersions(githubToken) {
|
async function getAvailableVersions(githubToken) {
|
||||||
const octokit = github.getOctokit(githubToken);
|
const octokit = github.getOctokit(githubToken, { baseUrl: constants_1.GITHUB_COM_API });
|
||||||
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
||||||
owner: constants_1.OWNER,
|
owner: constants_1.OWNER,
|
||||||
repo: constants_1.REPO,
|
repo: constants_1.REPO,
|
||||||
@@ -34671,7 +34671,7 @@ async function getAvailableVersions(githubToken) {
|
|||||||
return response.map((release) => release.tag_name);
|
return response.map((release) => release.tag_name);
|
||||||
}
|
}
|
||||||
async function getLatestVersion(githubToken) {
|
async function getLatestVersion(githubToken) {
|
||||||
const octokit = github.getOctokit(githubToken);
|
const octokit = github.getOctokit(githubToken, { baseUrl: constants_1.GITHUB_COM_API });
|
||||||
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
|
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
|
||||||
owner: constants_1.OWNER,
|
owner: constants_1.OWNER,
|
||||||
repo: constants_1.REPO,
|
repo: constants_1.REPO,
|
||||||
@@ -34820,10 +34820,11 @@ run();
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
exports.GITHUB_COM_API = exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
||||||
exports.REPO = "ruff";
|
exports.REPO = "ruff";
|
||||||
exports.OWNER = "astral-sh";
|
exports.OWNER = "astral-sh";
|
||||||
exports.TOOL_CACHE_NAME = "ruff";
|
exports.TOOL_CACHE_NAME = "ruff";
|
||||||
|
exports.GITHUB_COM_API = "https://api.github.com";
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
+2
-1
@@ -34644,10 +34644,11 @@ run();
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
exports.GITHUB_COM_API = exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
|
||||||
exports.REPO = "ruff";
|
exports.REPO = "ruff";
|
||||||
exports.OWNER = "astral-sh";
|
exports.OWNER = "astral-sh";
|
||||||
exports.TOOL_CACHE_NAME = "ruff";
|
exports.TOOL_CACHE_NAME = "ruff";
|
||||||
|
exports.GITHUB_COM_API = "https://api.github.com";
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
@@ -2,7 +2,12 @@ import * as core from "@actions/core";
|
|||||||
import * as tc from "@actions/tool-cache";
|
import * as tc from "@actions/tool-cache";
|
||||||
import * as path from "node:path";
|
import * as path from "node:path";
|
||||||
import { promises as fs } from "node:fs";
|
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 type { Architecture, Platform } from "../utils/platforms";
|
||||||
import { validateChecksum } from "./checksum/checksum";
|
import { validateChecksum } from "./checksum/checksum";
|
||||||
import * as github from "@actions/github";
|
import * as github from "@actions/github";
|
||||||
@@ -84,7 +89,7 @@ export async function resolveVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
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, {
|
const response = await octokit.paginate(octokit.rest.repos.listReleases, {
|
||||||
owner: OWNER,
|
owner: OWNER,
|
||||||
@@ -94,7 +99,7 @@ async function getAvailableVersions(githubToken: string): Promise<string[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getLatestVersion(githubToken: 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({
|
const { data: latestRelease } = await octokit.rest.repos.getLatestRelease({
|
||||||
owner: OWNER,
|
owner: OWNER,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export const REPO = "ruff";
|
export const REPO = "ruff";
|
||||||
export const OWNER = "astral-sh";
|
export const OWNER = "astral-sh";
|
||||||
export const TOOL_CACHE_NAME = "ruff";
|
export const TOOL_CACHE_NAME = "ruff";
|
||||||
|
export const GITHUB_COM_API = "https://api.github.com";
|
||||||
|
|||||||
Reference in New Issue
Block a user