mirror of
https://github.com/github/codeql-action.git
synced 2025-12-29 02:30:11 +08:00
* Bump @octokit/plugin-retry from 4.0.4 to 5.0.2 Bumps [@octokit/plugin-retry](https://github.com/octokit/plugin-retry.js) from 4.0.4 to 5.0.2. - [Release notes](https://github.com/octokit/plugin-retry.js/releases) - [Commits](https://github.com/octokit/plugin-retry.js/compare/v4.0.4...v5.0.2) --- updated-dependencies: - dependency-name: "@octokit/plugin-retry" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Angela P Wen <angelapwen@github.com>
35 lines
843 B
JavaScript
35 lines
843 B
JavaScript
import { errorRequest } from "./error-request";
|
|
import { wrapRequest } from "./wrap-request";
|
|
const VERSION = "0.0.0-development";
|
|
function retry(octokit, octokitOptions) {
|
|
const state = Object.assign(
|
|
{
|
|
enabled: true,
|
|
retryAfterBaseValue: 1e3,
|
|
doNotRetry: [400, 401, 403, 404, 422],
|
|
retries: 3
|
|
},
|
|
octokitOptions.retry
|
|
);
|
|
if (state.enabled) {
|
|
octokit.hook.error("request", errorRequest.bind(null, state, octokit));
|
|
octokit.hook.wrap("request", wrapRequest.bind(null, state, octokit));
|
|
}
|
|
return {
|
|
retry: {
|
|
retryRequest: (error, retries, retryAfter) => {
|
|
error.request.request = Object.assign({}, error.request.request, {
|
|
retries,
|
|
retryAfter
|
|
});
|
|
return error;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
retry.VERSION = VERSION;
|
|
export {
|
|
VERSION,
|
|
retry
|
|
};
|