Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent hitting github secondary rate limits #286

Merged
merged 7 commits into from May 6, 2023
Merged

fix: prevent hitting github secondary rate limits #286

merged 7 commits into from May 6, 2023

Conversation

varl
Copy link
Contributor

@varl varl commented May 4, 2023

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
Copy link

changeset-bot bot commented May 4, 2023

🦋 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
Name Type
@changesets/action Patch

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

varl and 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
src/run.ts Show resolved Hide resolved
src/run.ts Outdated Show resolved Hide resolved
@varl varl requested a review from Andarist May 5, 2023 10:56
@Andarist Andarist merged commit 225a1e8 into changesets:main May 6, 2023
1 check passed
@github-actions github-actions bot mentioned this pull request May 6, 2023
@varl varl deleted the request-throttling branch May 7, 2023 07:13
Sign up for free to 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