Conversation
|
Warning This is an internal experiment to assess Copilot's ability to auto-approve PRs. Please 👍 this comment if the assessment below is correct and 👎 if not. Feedback in #f-ccr-auto-approve is appreciated! Copilot thinks this PR is ready to approve and merge. |
There was a problem hiding this comment.
Pull request overview
This PR adds GitHub Enterprise Server (GHES) hostname support to GitHub API client creation and PR URL rendering, so the CLI can operate correctly against non-github.com hosts.
Changes:
- Extend the internal GitHub API client constructor to accept a
hostand create host-scoped REST/GraphQL clients. - Add a shared
PRURL()helper and use it ingh stack viewoutput instead of hardcodinggithub.com. - Add unit tests for
PRURL()and expand PR URL parsing tests to cover GHES hosts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/github/github.go | Adds host support to NewClient and introduces PRURL() for host-aware PR links. |
| internal/github/github_test.go | New unit test coverage for PRURL() across github.com, GHES, and empty-host defaulting. |
| internal/config/config.go | Passes the detected repository host into ghapi.NewClient(...). |
| cmd/view.go | Uses the repo host to render PR links via ghapi.PRURL(...) in both short and full views. |
| cmd/utils_test.go | Adds GHES examples to ensure PR URL parsing is host-agnostic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Support for custom hostnames:
ghapi.NewClientfunction and its usage throughout the codebase to accept ahostparameter, enabling API calls to work with bothgithub.comand GHES instances. (internal/github/github.go,internal/config/config.go,cmd/view.go) [1] [2] [3]cmd/view.goto pass the repository host where needed, including in functions that display PR information and construct PR URLs. [1] [2] [3] [4] [5]URL construction improvements:
PRURLfunction ininternal/github/github.goto generate pull request URLs for any host, and updated all relevant call sites to use this utility. [1] [2] [3]Testing:
internal/github/github_test.gowith tests for thePRURLfunction, coveringgithub.com, GHES hosts, and the defaulting behavior.cmd/utils_test.goto include test cases for parsing PR URLs from GHES instances.