mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Add a throttling plugin to the used Octokit instance to retry requests after hitting secondary rate limits (#286)
* fix: prevent hitting github secondary rate limits Adds the octokit plugin for throttling / rate-limiting to fix the problem where action runs get blocked with a 403 error[1]. The `github.getOctokit`[2] function accepts a list of plugins, so this passes in the `throttling` plugin[3] to be hooked into the octokit instance. It also needs some configuration to setup the `throttle` mechanisms, passed in to the `getOctokit` function. [1]: https://github.com/changesets/action/issues/192 [2]: https://github.com/actions/toolkit/blob/main/packages/github/src/github.ts#LL18C40-L18C40 [3]: https://github.com/octokit/plugin-throttling.js * refactor: change rate limit callback signatures Based on additional docs, the callbacks seem to have changes to their signatures[1]. This change aligns this implementation with the docs[2]. [1]: https://octokit.github.io/rest.js/v19#throttling [2]: https://github.com/octokit/plugin-throttling.js/blob/v5.1.1/src/index.ts#L90-L91 * chore: add changeset * wire up typed throttle options * Upgrade TS * refactor: use console based logging * Update .changeset/rotten-carrots-pump.md --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
This commit is contained in:
co-authored by
Mateusz Burzyński
parent
595655c3ea
commit
225a1e8cbc
+6
-2
@@ -10,7 +10,7 @@
|
||||
"fixturez": "^1.1.0",
|
||||
"parcel": "^1.12.3",
|
||||
"prettier": "^2.0.5",
|
||||
"typescript": "^3.5.3"
|
||||
"typescript": "^5.0.4"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "parcel build ./src/index.ts --no-source-maps --target=node --bundle-node-modules",
|
||||
@@ -33,6 +33,7 @@
|
||||
"@changesets/pre": "^1.0.9",
|
||||
"@changesets/read": "^0.5.3",
|
||||
"@manypkg/get-packages": "^1.1.3",
|
||||
"@octokit/plugin-throttling": "5.1.1",
|
||||
"@types/fs-extra": "^8.0.0",
|
||||
"@types/jest": "^24.0.18",
|
||||
"@types/node": "^12.7.1",
|
||||
@@ -51,5 +52,8 @@
|
||||
"husky": {
|
||||
"hooks": {}
|
||||
},
|
||||
"prettier": {}
|
||||
"prettier": {},
|
||||
"resolutions": {
|
||||
"**/@octokit/core": "4.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user