Skip to content

Look up the App's bot user with an installation token - #838

Open
stefanfoulis wants to merge 1 commit into
czpython:mainfrom
stefanfoulis:stefanfoulis/bot-author-authenticated
Open

stefanfoulis wants to merge 1 commit into
czpython:mainfrom
stefanfoulis:stefanfoulis/bot-author-authenticated

Conversation

@stefanfoulis

Copy link
Copy Markdown

Fixes #836.

get_bot_git_author looked up <slug>[bot] with an unauthenticated GET /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/installations lists), which has the normal 5,000/h limit. With no installation it raises GitHubAppNotInstalledError. 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_token replaces the unauthenticated-lookup test; tests/test_github.py passes.
  • Live, with the host's anonymous quota at 0/60: the old code got 403 and retry_after 2577 s; this branch returned the bot identity at once, and the waiting run's agent started right away.

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
@stefanfoulis
stefanfoulis requested a review from czpython as a code owner October 5, 2026 19:02

This branch has not been deployed

No deployments
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.

get_bot_git_author looks up the bot user without authentication and can stall a run for up to an hour

1 participant