feat(github): support enterprise PR indicators#5559
feat(github): support enterprise PR indicators#5559brianphillips wants to merge 1 commit intojesseduffield:masterfrom
Conversation
Resolve GitHub remotes through lazygit's hosting-service configuration so custom services entries using the github provider participate in the branch pull request indicator flow. Use the resolved web domain for gh token lookup and route Enterprise GraphQL requests to https://<host>/api/graphql while preserving github.com behavior. Filter GitHub remote candidates by available authentication before selecting or prompting for a base remote, avoiding stale gh-resolved writes when PR fetching cannot proceed. Document the GitHub Enterprise setup and cover service resolution, endpoint selection, auth host lookup, and authenticated remote filtering with tests.
|
quoting from #5516 (comment) :
@stefanhaller apologies for adding noise to this project. I admit, I did not read your CONTRIBUTING.md before creating the PR. This is my first time looking at the source of I'm just a (very grateful) user of lazygit and was attempting to be helpful by proposing something that would fix a gap in functionality for my (almost exclusively) GH enterprise-focused usage of lazygit but I understand if you need to close the PR due to the deluge that AI-coding has resulted in. Thanks for all your hard work on making this gem of a tool that I have used so much! 🍻 |
Summary
serviceswith thegithubprovider.ghauthentication and route Enterprise GraphQL requests tohttps://<webDomain>/api/graphqlwhile preserving github.com behavior.remote.<name>.gh-resolvedwrites when PR fetching cannot proceed.Testing
go test ./pkg/gui/controllers/helpers ./pkg/commands/git_commands ./pkg/commands/hosting_serviceI also ran
go test ./...; it failed in unrelated environment-sensitive style/i18n tests where ANSI colors were disabled and locale auto-detection returned English instead of localized strings.🤖 Agent Plan
Expand full agent plan
Add GitHub Enterprise Support For PR Indicators
Summary
Extend the existing GitHub PR indicator feature so it works for remotes configured in lazygit's
services:map asgithub:<webDomain>. Keep the behavior opt-in through existing config, reuseghauthentication for the enterprise host, and preserve current GitHub.com behavior.Key Changes
github.comor a configuredservicesentry whose provider isgithub.https://api.github.com/graphqlforgithub.comhttps://<webDomain>/api/graphql<webDomain>passed toauth.TokenForHostGitHubCommandsso PR fetching receives host/API information from the matched remote instead of hardcodinggithub.comandhttps://api.github.com/graphql.gh auth login --hostname <enterprise-host>services: { "<git-domain>": "github:<web-domain>" }Public Interfaces
servicesconfig becomes meaningful for GitHub PR discovery, not just generated PR/commit URLs.Test Plan
git@github.example.com:org/repo.gitwithservices.github.example.com = github:github.example.comgit.example.com = github:ghe.example.comgithub:ghe.example.com:8443GitHubCommandstests verifying GraphQL endpoint construction for GitHub.com and Enterprise.TokenForHostreceives the enterprise web host, not the default host.servicesdo not trigger GitHub PR fetching.go test ./pkg/commands/hosting_service ./pkg/commands/git_commands ./pkg/gui/controllers/helpers.Assumptions
https://<webDomain>/api/graphql.services:map is the source of truth for custom GitHub Enterprise hosts.ghfor the enterprise hostname before lazygit can fetch PRs.Review Feedback Follow-up
remote.<name>.gh-resolvedfor unauthenticated remotes.