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

Handle Rate Limit #22

Closed
pattacini opened this issue Nov 18, 2020 · 5 comments · Fixed by #24
Closed

Handle Rate Limit #22

pattacini opened this issue Nov 18, 2020 · 5 comments · Fixed by #24
Assignees

Comments

@pattacini
Copy link
Member

pattacini commented Nov 18, 2020

Instead of letting the action fail because of having hit the rate limit, we may consider handling it through suitable wait states by reading relevant info via the API.

See:

@pattacini pattacini self-assigned this Nov 18, 2020
@pattacini pattacini linked a pull request Nov 20, 2020 that will close this issue
@pattacini
Copy link
Member Author

Done in #24

@JeroenKnoops
Copy link
Contributor

@pattacini FYI

Although this solution works, I have changed the workflow a little bit, and instead of using a PAT, we're now using a github app to do all the API calls.

We've used something similar to: https://github.com/peter-murray/workflow-application-token-action

You can grant the exact permissions to an app, and with the workflow-application-token-action you can get a temporary token to do all API calls. This will no longer case any rate limit to be hit since the number is set a lot higher for apps.

See: https://docs.github.com/en/developers/apps/rate-limits-for-github-apps

Workflow will look something like:

      - uses: peter-murray/workflow-application-token-action@v1
        name: Retrieve App Token
        id: app_token
        with:
          application_id: ${{ secrets.APP_ID }}
          application_private_key: ${{ secrets.APP_PRIVATE_KEY }}

      - name: Outside collaborators
        run: |
          cd scripts
          ./outside-collaborators-handler.rb
        env:
          OUTSIDE_COLLABORATORS_GITHUB_ORG: ${{ github.repository_owner }}
          OUTSIDE_COLLABORATORS_GITHUB_TOKEN: $ {{ steps.app_token.outputs.token }}

I can't really make a PR, because without creating an app it's hard to tell if it works in your case.

@pattacini
Copy link
Member Author

pattacini commented Feb 3, 2021

Thanks a lot @JeroenKnoops for this nice suggestion!
I may give it a try in the upcoming days. Either way, I'll be documenting somehow this addition from the main README.md

@pattacini
Copy link
Member Author

pattacini commented Feb 5, 2021

Hi @JeroenKnoops

I've incorporated your suggestion in the main README (see 46d1ee1), but with a second thought, I believe this further layer would add an unnecessary complication now as we rarely hit the rate limit.

I'll certainly be considering this again in the future if I'll start out experiencing downgraded performances in our context.

Thanks heaps for the nice feedback!

@JeroenKnoops
Copy link
Contributor

We were having a lot of rate limit hits, because we were using the same user also for other actions like gathering metric with CHAOSS. That's why this was our solution. I just wanted to share it for the future or when other people have similar issues! :)

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 a pull request may close this issue.

2 participants