jesseduffield / jesseduffield/lazygit
GitHub PR fetch cannot be disabled, causes 401 errors when switching submodules
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
### Is your feature request related to a problem? Please describe.
When working in a monorepo with submodules, lazygit attempts to fetch GitHub PRs via the GraphQL API every time you switch between submodules or lazygit receives focus. If the gh CLI has an expired token (while git SSH still works fine), this produces a repeated error on every switch:
```
Error fetching pull requests from GitHub: GraphQL query failed with status: 401 Unauthorized. Body: {
"message": "Bad credentials",
"documentation_url": "https://docs.github.com/rest",
"status": "401"
}
```
The code only skips PR fetching if `GetAuthToken()` returns an empty string, but an expired gh token returns a non-empty invalid token, so the early-exit check is bypassed.
### Describe the solution you'd like
Add a `git.showGithubPullRequests` config option (default true) and guard `refreshGithubPullRequests()` with it, so users who don't use the PR feature can opt out entirely.
### Describe alternatives you've considered
No.
### Additional context
- lazygit version: 0.61.1
- OS: macOS
- Use case: monorepo with submodules, git SSH auth works, gh token expired
Contributor guide
Assessment
This issue has not been assessed yet.