Look up the App's bot user with an installation token - #838
Open
stefanfoulis wants to merge 1 commit into
Open
stefanfoulis wants to merge 1 commit into
stefanfoulis wants to merge 1 commit into
Conversation
Unauthenticated, GET /users shares the host IP's 60 requests an hour. With the limit used up, githubkit sleeps until the reset, and the run waits before its agent starts. Any installation's token lifts the limit. Fixes czpython#836
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #836.
get_bot_git_authorlooked up<slug>[bot]with an unauthenticatedGET /users/{login}. That shares the host IP's 60 requests an hour; when they are used up, githubkit sleeps until the reset and the run waits after its clone, before the agent starts (up to an hour).The lookup now uses an installation token of the App (the first installation that
GET /app/installationslists), which has the normal 5,000/h limit. With no installation it raisesGitHubAppNotInstalledError. The result stays cached per App id as before.Any installation is used, not the run's repository: a run can work on a repository through another identity, where the App is not installed.
Tests
test_get_bot_git_author_composes_the_bot_identity_with_an_installation_tokenreplaces the unauthenticated-lookup test;tests/test_github.pypasses.retry_after2577 s; this branch returned the bot identity at once, and the waiting run's agent started right away.