mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 17:20:10 +08:00
* Bump @octokit/types from 9.0.0 to 10.0.0 Bumps [@octokit/types](https://github.com/octokit/types.ts) from 9.0.0 to 10.0.0. - [Release notes](https://github.com/octokit/types.ts/releases) - [Commits](https://github.com/octokit/types.ts/compare/v9.0.0...v10.0.0) --- updated-dependencies: - dependency-name: "@octokit/types" 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>
plugin-retry.js
Retries requests for server 4xx/5xx responses except
400,401,403,404, and422.
Usage
| Browsers |
Load |
|---|---|
| Node |
Install with |
const MyOctokit = Octokit.plugin(retry);
const octokit = new MyOctokit({ auth: "secret123" });
// retries request up to 3 times in case of a 500 response
octokit.request("/").catch((error) => {
if (error.request.request.retryCount) {
console.log(
`request failed after ${error.request.request.retryCount} retries`
);
}
console.error(error);
});
To override the default doNotRetry list:
const octokit = new MyOctokit({
auth: "secret123",
retry: {
doNotRetry: [
/* List of HTTP 4xx/5xx status codes */
],
},
});
To override the number of retries:
const octokit = new MyOctokit({
auth: "secret123",
request: { retries: 1 },
});
You can manually ask for retries for any request by passing { request: { retries: numRetries, retryAfter: delayInSeconds }}. Note that the doNotRetry option from the constructor is ignored in this case, requests will be retried no matter their response code.
octokit
.request("/", { request: { retries: 1, retryAfter: 1 } })
.catch((error) => {
if (error.request.request.retryCount) {
console.log(
`request failed after ${error.request.request.retryCount} retries`
);
}
console.error(error);
});
Pass { retry: { enabled: false } } to disable this plugin.
Contributing
See CONTRIBUTING.md