Skip to content

feat: dynamically discover GitHub App installations via API#203

Merged
jrobotham-square merged 1 commit intomainfrom
jrobotham/dynamic-installation-discovery
Mar 20, 2026
Merged

feat: dynamically discover GitHub App installations via API#203
jrobotham-square merged 1 commit intomainfrom
jrobotham/dynamic-installation-discovery

Conversation

@jrobotham-square
Copy link
Contributor

Instead of requiring all org installation IDs to be statically configured in cachew.hcl, dynamically resolve them by querying the GitHub API (GET /orgs/{org}/installation, falling back to /users/{user}/installation).

Static installations config still works and is checked first. Dynamic discovery only triggers for orgs not in the static map. Results are cached in memory for subsequent requests.

This fixes clone failures for orgs like AfterpayTouch where the GitHub App is installed but the installation ID wasn't in the config. Ports the same approach used in blox's internal/github/app_auth.go.

@jrobotham-square jrobotham-square force-pushed the jrobotham/dynamic-installation-discovery branch 2 times, most recently from ba6e2b4 to ef33bea Compare March 20, 2026 03:07
Instead of requiring org installation IDs to be statically configured in
cachew.hcl, dynamically resolve them by querying the GitHub API
(GET /orgs/{org}/installation, falling back to /users/{user}/installation).

Removes the static Installations map from Config entirely. Installation
IDs are discovered on first use and cached in memory. The fallback-org
config is retained for orgs where the app is not installed.

This fixes clone failures for orgs like AfterpayTouch where the GitHub
App is installed but the installation ID wasn't in the config. Ports the
same approach used in blox's internal/github/app_auth.go.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d0910-4486-750f-bb6b-0629397da303
@jrobotham-square jrobotham-square force-pushed the jrobotham/dynamic-installation-discovery branch from ef33bea to 86db55c Compare March 20, 2026 03:14
@jrobotham-square jrobotham-square marked this pull request as ready for review March 20, 2026 03:14
@jrobotham-square jrobotham-square requested a review from a team as a code owner March 20, 2026 03:14
@jrobotham-square jrobotham-square requested review from worstell and removed request for a team March 20, 2026 03:14
@jrobotham-square jrobotham-square merged commit e362d3d into main Mar 20, 2026
7 checks passed
@jrobotham-square jrobotham-square deleted the jrobotham/dynamic-installation-discovery branch March 20, 2026 03:17
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.

2 participants