From fd9e9f0a337e65c7336db3b8e1077762a436a310 Mon Sep 17 00:00:00 2001 From: Hugh O'Brien Date: Fri, 10 Jul 2026 23:15:57 +0000 Subject: [PATCH] fix(github): use api.github.com base URL for GitHub App auth (#1823) The Setup() function was incorrectly using the web host (https://github.com) instead of the API host (https://api.github.com) when creating the go-scm client for GitHub App authentication. This caused 404 errors when the branch-planner attempted to list pull requests. For GitHub.com: - Now uses https://api.github.com (was: https://github.com) For GHE: - Now uses /api/v3 for both transport.BaseURL and github.New() - Previously only set transport.BaseURL, but still passed the web host to New() This mirrors the pattern used in the token auth path where factory.NewClient properly calls ensureGHEEndpoint. Fixes #1823 --- internal/git/provider/github_provider.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/git/provider/github_provider.go b/internal/git/provider/github_provider.go index 54991699..6102a275 100644 --- a/internal/git/provider/github_provider.go +++ b/internal/git/provider/github_provider.go @@ -211,11 +211,13 @@ func (p *GitHubProvider) Setup() error { return fmt.Errorf("failed to create github app transport: %w", err) } + apiURL := "https://api.github.com" if p.hostname != "github.com" { - transport.BaseURL = serverURL + "/api/v3" + apiURL = serverURL + "/api/v3" + transport.BaseURL = apiURL } - p.client, err = github.New(serverURL) + p.client, err = github.New(apiURL) if err != nil { return fmt.Errorf("failed to create github client: %w", err) }