Support GitHub Enterprise hosts for repository operations#16371
Support GitHub Enterprise hosts for repository operations#16371
Conversation
|
Fixes #16312 |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds GitHub Enterprise host support for repository operations by introducing GetGitHubHost() helper functions and updating hardcoded https://github.com/ references throughout the codebase to use dynamic host resolution. The implementation checks environment variables (GITHUB_SERVER_URL, GITHUB_ENTERPRISE_HOST, GITHUB_HOST, GH_HOST) in priority order and defaults to https://github.com.
Changes:
- Added
GetGitHubHost()inpkg/parser/github.go(exported) andgetGitHubHost()inpkg/cli/github.go(unexported) for environment-based GitHub host resolution - Updated Git operations in parser and CLI packages to construct repository URLs using the resolved GitHub host
- Modified validation patterns to accept any GitHub host while maintaining security and structural constraints
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/github.go | Added exported GetGitHubHost() function with environment variable priority order and URL normalization |
| pkg/parser/remote_fetch.go | Updated 3 git ls-remote and archive operations to use GetGitHubHost() for repository URLs |
| pkg/cli/download_workflow.go | Updated 6 git operations (release resolution, branch checks, content downloads) to use getGitHubHost() |
| pkg/cli/update_actions.go | Updated git ls-remote for action release fetching to use getGitHubHost() |
| pkg/cli/trial_command.go | Updated 3 workflow run URL and host repository URL constructions to use getGitHubHost() |
| pkg/cli/spec.go | Enhanced GitHub URL parsing to support both https:// and http:// prefixes with dynamic host resolution |
| pkg/cli/pr_command.go | Updated fork repository URL construction to use getGitHubHost() |
| pkg/cli/git.go | Updated parseGitHubRepoSlugFromURL() to handle both HTTPS and SSH formats for any GitHub host |
| pkg/workflow/safe_output_validation_config.go | Changed project URL validation pattern from hardcoded github.com to ^https://[^/]+/ to accept any host |
| actions/setup/js/update_project.cjs | Updated 2 regex patterns to match project URLs from any GitHub host (parseProjectInput and parseProjectUrl) |
| actions/setup/js/create_project_status_update.cjs | Updated regex pattern in parseProjectUrl to match project URLs from any GitHub host |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🧪 Smoke Project is now testing project operations... |
|
❌ Smoke Copilot SDK failed. Please review the logs for details. |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
✅ Smoke Project completed successfully. All project operations validated. |
|
PR titles:
|
|
@copilot merge main and recompile |
|
📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing... |
|
🎬 THE END — Smoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨ |
|
🧪 Smoke Project is now testing project operations... |
|
❌ Smoke Copilot SDK failed. Please review the logs for details. |
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 |
|
🧪 Smoke Temporary ID is now testing temporary ID functionality... |
Agent Container Tool Check
Result: 12/12 tools available ✅
|
|
✅ Smoke Temporary ID completed successfully. Temporary ID validation passed. |
|
✅ Smoke Project completed successfully. All project operations validated. |
|
🎭 Copilot swoops in dramatically Greetings, The cosmic dance between
|
|
PR titles:
|
Smoke Test: Copilot - §22110257263PRs Tested:
Results:
Status: FAIL (10/11 passed)
|
There was a problem hiding this comment.
Solid GitHub Enterprise support implementation. The constant extraction and repo-specific host resolution are well-designed patterns.
📰 BREAKING: Report filed by Smoke Copilot for issue #16371
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤 |
Smoke Test Results - ClaudeCore Tests: ✅ 9/10 passed, Overall Status: PARTIAL [View full report in issue created above]
|
There was a problem hiding this comment.
💥 Automated smoke test review - all systems nominal!
💥 [THE END] — Illustrated by Smoke Claude for issue #16371
Summary
Extracted the hardcoded "https://github.com" string to a constant
constants.PublicGitHubHostto eliminate duplication and improve maintainability. Updated all usages inpkg/parser/github.goandpkg/cli/github.goto reference this constant.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
Changeset
Changeset