mirror of
https://github.com/softprops/action-gh-release.git
synced 2025-06-28 22:26:02 +00:00
node_modules
This commit is contained in:
parent
5e3f23f92c
commit
806116bda4
734 changed files with 224451 additions and 0 deletions
15
node_modules/@octokit/plugin-retry/dist-src/error-request.js
generated
vendored
Normal file
15
node_modules/@octokit/plugin-retry/dist-src/error-request.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
// @ts-ignore
|
||||
export async function errorRequest(octokit, state, error, options) {
|
||||
if (!error.request || !error.request.request) {
|
||||
// address https://github.com/octokit/plugin-retry.js/issues/8
|
||||
throw error;
|
||||
}
|
||||
// retry all >= 400 && not doNotRetry
|
||||
if (error.status >= 400 && !state.doNotRetry.includes(error.status)) {
|
||||
const retries = options.request.retries != null ? options.request.retries : state.retries;
|
||||
const retryAfter = Math.pow((options.request.retryCount || 0) + 1, 2);
|
||||
throw octokit.retry.retryRequest(error, retries, retryAfter);
|
||||
}
|
||||
// Maybe eventually there will be more cases here
|
||||
throw error;
|
||||
}
|
26
node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
Normal file
26
node_modules/@octokit/plugin-retry/dist-src/index.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { errorRequest } from "./error-request";
|
||||
import { wrapRequest } from "./wrap-request";
|
||||
export const VERSION = "0.0.0-development";
|
||||
export function retry(octokit, octokitOptions = {}) {
|
||||
const state = Object.assign({
|
||||
enabled: true,
|
||||
retryAfterBaseValue: 1000,
|
||||
doNotRetry: [400, 401, 403, 404, 422],
|
||||
retries: 3,
|
||||
}, octokitOptions.retry);
|
||||
octokit.retry = {
|
||||
retryRequest: (error, retries, retryAfter) => {
|
||||
error.request.request = Object.assign({}, error.request.request, {
|
||||
retries: retries,
|
||||
retryAfter: retryAfter,
|
||||
});
|
||||
return error;
|
||||
},
|
||||
};
|
||||
if (!state.enabled) {
|
||||
return;
|
||||
}
|
||||
octokit.hook.error("request", errorRequest.bind(null, octokit, state));
|
||||
octokit.hook.wrap("request", wrapRequest.bind(null, state));
|
||||
}
|
||||
retry.VERSION = VERSION;
|
1
node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
Normal file
1
node_modules/@octokit/plugin-retry/dist-src/version.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export const VERSION = "3.0.2";
|
18
node_modules/@octokit/plugin-retry/dist-src/wrap-request.js
generated
vendored
Normal file
18
node_modules/@octokit/plugin-retry/dist-src/wrap-request.js
generated
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
// @ts-ignore
|
||||
import Bottleneck from "bottleneck/light";
|
||||
// @ts-ignore
|
||||
export async function wrapRequest(state, request, options) {
|
||||
const limiter = new Bottleneck();
|
||||
// @ts-ignore
|
||||
limiter.on("failed", function (error, info) {
|
||||
const maxRetries = ~~error.request.request.retries;
|
||||
const after = ~~error.request.request.retryAfter;
|
||||
options.request.retryCount = info.retryCount + 1;
|
||||
if (maxRetries > info.retryCount) {
|
||||
// Returning a number instructs the limiter to retry
|
||||
// the request after that number of milliseconds have passed
|
||||
return after * state.retryAfterBaseValue;
|
||||
}
|
||||
});
|
||||
return limiter.schedule(request, options);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue