Repository navigation
Conversation
GitHub Enterprise is a third host next to github.com and Bitbucket, rather
than a replacement API base URL, so work and open-source PRs can be watched
together.
- forge: any <host>/owner/repo/pull/N URL parses, with the host kept; hosts
other than github.com and bitbucket.org are GitHub Enterprise. Links, the
watch-list host and list labels ("github.acme.com:team/api") follow.
- config: github_enterprise_url and github_enterprise_token; the token falls
back to GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN and
`gh auth token --hostname <host>`, never to the github.com token.
- github: EnterpriseAPIURL (<host>/api/v3, or api.<sub>.ghe.com) and
NewEnterpriseClient.
- clientFor, prw run (client + auto-watch finder), the dashboard source and
the MCP tools use it; unknown hosts get a hint to set github_enterprise_url.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9339c2e575
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if err != nil { | ||
| return nil | ||
| } | ||
| return watcher.GitHubFinder{Searcher: c, HostName: host} |
There was a problem hiding this comment.
Parse Enterprise URLs in the search-result decoder
For a configured Enterprise instance, this finder calls github.Client.SearchPullRequests, but that method still decodes each result using github.ParsePRURL (internal/github/client.go:403), whose regex only accepts github.com. Consequently, results with URLs such as https://github.acme.com/team/api/pull/9 are silently skipped, so Enterprise auto-watch never discovers PRs. The new dashboard source uses the same method and likewise displays no Enterprise PRs. Update the search-result decoder to accept Enterprise URLs as well.
Useful? React with 👍 / 👎.
| if len(cfg.AutoWatch) > 0 && !bitbucketConfigured(cfg) && cfg.EnterpriseHost() == "" { | ||
| return true // auto-watch has nothing else to search |
There was a problem hiding this comment.
Allow Enterprise-only auto-watch with an empty watch list
When only Enterprise credentials are configured and auto-watch is enabled, an empty watch list still makes needsGitHub return true through its final return len(cfg.WatchedPRs) == 0. Thus, after all watched Enterprise PRs close—or when the initial search finds none—prw run exits with errMissingToken in cmd/prw/main.go:435–436, before registering the Enterprise finder. Account for the configured Enterprise auto-watch host in the empty-list fallback so monitoring can start without a github.com token.
Useful? React with 👍 / 👎.
Closes #2.
Approach
#2 asked for an
api_base_urlreplacinghttps://api.github.com. Since prw now has per-host clients (Bitbucket), GitHub Enterprise is added as another host instead: github.com keeps working, and people with GitHub at work and open source on github.com can watch both.https://<host>/api/v3(Enterprise Server) orhttps://api.<sub>.ghe.com(GHE.com); the URL is validated onconfig set.github_enterprise_token→GH_ENTERPRISE_TOKEN→GITHUB_ENTERPRISE_TOKEN→gh auth token --hostname <host>. The github.com token is never sent to the Enterprise host.watch/run/wait/checks --logs/list/broadcast/dashboard, auto-watch (--mine/--review-requestedsearch both hosts) and MCP.prw flakystays github.com-only.Test plan
go test -race ./...,go vet ./...www.), API URL derivation, token precedence, config validationclientForon an Enterprise URL sendsGET /api/v3/repos/team/api/pulls/9with the Enterprise token (fake server)🤖 Generated with Claude Code