forked from mirrors/action-gh-release
retry requests
This commit is contained in:
parent
6247f9299a
commit
2e7c800734
6 changed files with 53 additions and 5 deletions
16
lib/main.js
16
lib/main.js
|
@ -21,7 +21,21 @@ function run() {
|
|||
if (!util_1.isTag(config.github_ref)) {
|
||||
throw new Error(`⚠️ GitHub Releases requires a tag`);
|
||||
}
|
||||
const gh = new github_2.GitHub(config.github_token);
|
||||
github_2.GitHub.plugin(require("@octokit/plugin-throttling"));
|
||||
const gh = new github_2.GitHub(config.github_token, {
|
||||
onRateLimit: (retryAfter, options) => {
|
||||
console.warn(`Request quota exhausted for request ${options.method} ${options.url}`);
|
||||
if (options.request.retryCount === 0) {
|
||||
// only retries once
|
||||
console.log(`Retrying after ${retryAfter} seconds!`);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
onAbuseLimit: (retryAfter, options) => {
|
||||
// does not retry, only logs a warning
|
||||
console.warn(`Abuse detected for request ${options.method} ${options.url}`);
|
||||
}
|
||||
});
|
||||
let rel = yield github_1.release(config, new github_1.GitHubReleaser(gh));
|
||||
if (config.input_files) {
|
||||
util_1.paths(config.input_files).forEach((path) => __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue