mirror of
https://github.com/github/codeql-action.git
synced 2025-12-10 01:34:36 +08:00
Fix retrying uploads by using Octokit retry plugin.
This commit is contained in:
8
lib/api-client.js
generated
8
lib/api-client.js
generated
@@ -10,7 +10,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const github = __importStar(require("@actions/github"));
|
||||
const githubUtils = __importStar(require("@actions/github/lib/utils"));
|
||||
const retry = __importStar(require("@octokit/plugin-retry"));
|
||||
const console_log_level_1 = __importDefault(require("console-log-level"));
|
||||
const path = __importStar(require("path"));
|
||||
const actions_util_1 = require("./actions-util");
|
||||
@@ -19,11 +20,12 @@ exports.getApiClient = function (githubAuth, githubUrl, allowLocalRun = false) {
|
||||
if (util_1.isLocalRun() && !allowLocalRun) {
|
||||
throw new Error("Invalid API call in local run");
|
||||
}
|
||||
return github.getOctokit(githubAuth, {
|
||||
const retryingOctokit = githubUtils.GitHub.plugin(retry.retry);
|
||||
return new retryingOctokit(githubUtils.getOctokitOptions(githubAuth, {
|
||||
baseUrl: getApiUrl(githubUrl),
|
||||
userAgent: "CodeQL Action",
|
||||
log: console_log_level_1.default({ level: "debug" }),
|
||||
});
|
||||
}));
|
||||
};
|
||||
function getApiUrl(githubUrl) {
|
||||
const url = new URL(githubUrl);
|
||||
|
||||
Reference in New Issue
Block a user