Skip to content

fix: prevent hitting github secondary rate limits - #286

Merged
Andarist merged 7 commits into
changesets:mainfrom
varl:request-throttling
May 6, 2023
Merged

fix: prevent hitting github secondary rate limits#286
Andarist merged 7 commits into
changesets:mainfrom
varl:request-throttling

Conversation

@varl

@varlvarl commented May 4, 2023

Copy link
Copy Markdown
Contributor

Adds the octokit plugin for throttling / rate-limiting to fix the problem where action runs get blocked with a 403 error1.

The github.getOctokit2 function accepts a list of plugins, so this passes in the throttling plugin3 to be hooked into the octokit instance.

It also needs some configuration to setup the throttle mechanisms, passed in to the getOctokit function.

closes#192

@changeset-bot

changeset-botBot commented May 4, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: de4dff0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@changesets/actionPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

varland others added 4 commits May 4, 2023 20:33
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]: #192
[2]: https://github.com/actions/toolkit/blob/main/packages/github/src/github.ts#LL18C40-L18C40
[3]: https://github.com/octokit/plugin-throttling.js
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
Comment threadsrc/run.ts
Comment threadsrc/run.ts Outdated
@varl
varl requested a review from AndaristMay 5, 2023 10:56
Comment thread.changeset/rotten-carrots-pump.md Outdated
@Andarist
Andarist merged commit 225a1e8 into changesets:mainMay 6, 2023
@github-actionsgithub-actionsBot mentioned this pull request May 6, 2023
@varl
varl deleted the request-throttling branch May 7, 2023 07:13
tom-sherman pushed a commit to tom-sherman/action that referenced this pull request Mar 16, 2026
…s after hitting secondary rate limits (changesets#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]: changesets#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>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

403: You have exceeded a secondary rate limit

2 participants

@varl@Andarist