Conversation
…erprise compatibility Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
lint go, recompile |
|
Use the following envs to resolve: GITHUB_SERVER_URL: https://MYORG.ghe.com do not use github_api_url update code in gh helpers that also resolve host, centralize helpers |
- Create centralized gitutil.GetGitHubHost() function - Support environment variables in priority order: 1. GITHUB_SERVER_URL (e.g., https://MYORG.ghe.com) 2. GITHUB_ENTERPRISE_HOST (e.g., MYORG.ghe.com) 3. GITHUB_HOST (e.g., MYORG.ghe.com) 4. GH_HOST (e.g., MYORG.ghe.com) - Add https:// prefix if not present (http:// or https://) - Remove trailing slashes - Default to https://github.com if no env vars set - Update pkg/cli/github.go to use centralized function - Add comprehensive tests for all environment variables - Tests verify priority order, URL normalization, and edge cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Completed in commit 286066c:
The linter requires
Centralized in commit 286066c: Created
Updated ✅ 32 tests added and passing Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
pkg/cli/github.go
Outdated
|
|
||
| // Remove trailing slash for consistency | ||
| return strings.TrimSuffix(host, "/") | ||
| return gitutil.GetGitHubHost() |
There was a problem hiding this comment.
@copilot the helper source code belongs here, it is a GitHub feature
There was a problem hiding this comment.
Moved to pkg/cli/github.go in commit a9c9536. The GitHub host resolution is now implemented directly in the CLI package where GitHub-specific features belong.
… GitHub host resolution for GHE Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Fixes two GitHub Enterprise compatibility issues:
permissions: all: readunconditionally expands to all scopes includingdiscussions: read, breaking GitHub Enterprise deployments without discussions enabled.Changes
Discussions Permission Fix
discussionsscope duringall: readexpansion unless explicitly present in permissions mapdiscussionsno longer auto-includedGitHub Host Resolution Enhancement
getGitHubHost()with full GitHub Enterprise environment variable supportBehavior
Permissions Before Fix
→ Expands to all scopes including
discussions: readPermissions After Fix
→ Expands to all scopes except
discussionsandid-tokenExplicit discussions permission still works:
→ Includes
discussions: readas expectedSafe-outputs that require discussions (
add-comment,create-discussion, etc.) continue to add the permission viacomputePermissionsForSafeOutputs().GitHub Host Resolution
Environment variables checked in priority order:
https://MYORG.ghe.com)MYORG.ghe.com)MYORG.ghe.com)MYORG.ghe.com)Defaults to
https://github.saobby.my.eu.orgif none are set.Testing
Compatibility
Improves GitHub Enterprise compatibility:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
✨ PR Review Safe Output Test - Run 22100482055