File tree Expand file tree Collapse file tree 3 files changed +41
-2
lines changed
Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 132132 },
133133 "dependencies" : {
134134 "@babel/runtime" : " ^7.1.5" ,
135+ "@octokit/plugin-throttling" : " ^2.4.0" ,
135136 "@octokit/rest" : " ^16.25.1" ,
136137 "chalk" : " ^2.4.2" ,
137138 "js-base64" : " ^2.5.1" ,
Original file line number Diff line number Diff line change @@ -6,13 +6,39 @@ import npmRegistryFetch from 'npm-registry-fetch'
66import { Base64 } from 'js-base64'
77import parseChangelog , { type Release } from './changelog-parser'
88import semver from 'semver'
9- import Octokit from '@octokit/rest'
9+ import _Octokit from '@octokit/rest'
10+ import octokitThrottling from '@octokit/plugin-throttling'
1011import getNpmToken from './getNpmToken'
1112import memoize from './util/memoize'
1213
14+ const Octokit = _Octokit . plugin ( octokitThrottling )
15+
1316const { GH_TOKEN } = process . env
1417
15- const octokitOptions = { }
18+ type LimitOptions = {
19+ method : string ,
20+ url : string ,
21+ request : {
22+ retryCount : number ,
23+ } ,
24+ }
25+
26+ const octokitOptions : Object = {
27+ throttle : {
28+ onRateLimit : ( retryAfter : number , options : LimitOptions ) => {
29+ octokit . log . warn (
30+ `Request quota exhausted for request ${ options . method } ${ options . url } `
31+ )
32+ return options . request . retryCount < 3
33+ } ,
34+ onAbuseLimit : ( retryAfter : number , options : LimitOptions ) => {
35+ // does not retry, only logs a warning
36+ octokit. log . warn (
37+ `Abuse detected for request ${ options . method } ${ options . url } `
38+ )
39+ } ,
40+ } ,
41+ }
1642if ( GH_TOKEN ) octokitOptions . auth = `token ${ GH_TOKEN } `
1743const octokit = new Octokit ( octokitOptions )
1844
Original file line number Diff line number Diff line change 922922 universal-user-agent "^2.0.1"
923923 url-template "^2.0.8"
924924
925+ " @octokit/plugin-throttling@^2.4.0 " :
926+ version "2.4.0"
927+ resolved "https://registry.yarnpkg.com/@octokit/plugin-throttling/-/plugin-throttling-2.4.0.tgz#add1bd6a797aa210ce860e8bbe7f7505ba5e4d99"
928+ integrity sha512-0bYfgQdqAtWiqXvS6oKMiousTno+e3pFoaYS57LpAp8p56Far49/vpGvbEvBUuNyoUFgOcTGm5WTpO1IPptHuQ==
929+ dependencies :
930+ bottleneck "^2.15.3"
931+
925932" @octokit/request@3.0.1 " :
926933 version "3.0.1"
927934 resolved "https://registry.yarnpkg.com/@octokit/request/-/request-3.0.1.tgz#21e888c6dce80566ec69477360bab79f2f14861f"
@@ -1518,6 +1525,11 @@ bottleneck@^2.0.1:
15181525 resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.13.0.tgz#875df17df9e62c76bea42b62af3a45c73a995c4f"
15191526 integrity sha512-9YmZ0aiKta2OAxTujKCS/INjGWCIGWK4Ff1nQpgHnR4CTjlk9jcnpaHOjPnMZPtqRXkqwKdtxZgvJ9udsXylaw==
15201527
1528+ bottleneck@^2.15.3 :
1529+ version "2.18.0"
1530+ resolved "https://registry.yarnpkg.com/bottleneck/-/bottleneck-2.18.0.tgz#41fa63ae185b65435d789d1700334bc48222dacf"
1531+ integrity sha512-U1xiBRaokw4yEguzikOl0VrnZp6uekjpmfrh6rKtr1D+/jFjYCL6J83ZXlGtlBDwVdTmJJ+4Lg5FpB3xmLSiyA==
1532+
15211533boxen@^1.2.1 :
15221534 version "1.3.0"
15231535 resolved "https://registry.yarnpkg.com/boxen/-/boxen-1.3.0.tgz#55c6c39a8ba58d9c61ad22cd877532deb665a20b"
You can’t perform that action at this time.
0 commit comments