Fix retrying uploads by using Octokit retry plugin.

This commit is contained in:
Chris Gavin
2020-09-21 11:06:21 +01:00
parent e67ba57e65
commit 31c2eca167
118 changed files with 19025 additions and 117 deletions

8
lib/api-client.js generated
View File

@@ -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);