Gathering detailed insights and metrics for @octokit/plugin-retry
Gathering detailed insights and metrics for @octokit/plugin-retry
Gathering detailed insights and metrics for @octokit/plugin-retry
Gathering detailed insights and metrics for @octokit/plugin-retry
Octokit plugin for GitHub’s recommended request retries
npm install @octokit/plugin-retry
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
38 Stars
604 Commits
18 Forks
12 Watching
8 Branches
24 Contributors
Updated on 26 Nov 2024
TypeScript (88.17%)
JavaScript (11.83%)
Cumulative downloads
Total Downloads
Last day
-4.5%
392,707
Compared to previous day
Last week
4.3%
2,322,796
Compared to previous week
Last month
9.2%
9,756,869
Compared to previous month
Last year
118.1%
91,035,336
Compared to previous year
Retries requests for server 4xx/5xx responses except
400
,401
,403
,404
,422
, and451
.
Browsers |
Load
|
---|---|
Node |
Install with
|
[!IMPORTANT] As we use conditional exports, you will need to adapt your
tsconfig.json
by setting"moduleResolution": "node16", "module": "node16"
.See the TypeScript docs on package.json "exports".
See this helpful guide on transitioning to ESM from @sindresorhus
1const MyOctokit = Octokit.plugin(retry); 2const octokit = new MyOctokit({ auth: "secret123" }); 3 4// retries request up to 3 times in case of a 500 response 5octokit.request("/").catch((error) => { 6 if (error.request.request.retryCount) { 7 console.log( 8 `request failed after ${error.request.request.retryCount} retries`, 9 ); 10 } 11 12 console.error(error); 13});
To override the default doNotRetry
list:
1const octokit = new MyOctokit({ 2 auth: "secret123", 3 retry: { 4 doNotRetry: [ 5 /* List of HTTP 4xx/5xx status codes */ 6 ], 7 }, 8});
To override the number of retries:
1const octokit = new MyOctokit({ 2 auth: "secret123", 3 request: { retries: 1 }, 4});
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.
1octokit 2 .request("/", { request: { retries: 1, retryAfter: 1 } }) 3 .catch((error) => { 4 if (error.request.request.retryCount) { 5 console.log( 6 `request failed after ${error.request.request.retryCount} retries`, 7 ); 8 } 9 10 console.error(error); 11 });
Pass { retry: { enabled: false } }
to disable this plugin.
See CONTRIBUTING.md
No vulnerabilities found.
Reason
all changesets reviewed
Reason
no dangerous workflow patterns detected
Reason
20 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
SAST tool is run on all commits
Details
Reason
0 existing vulnerabilities detected
Reason
security policy file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More