Fix gh pr checkout failing with GH_HOST mismatch in issue_comment workflows#26037
Draft
Fix gh pr checkout failing with GH_HOST mismatch in issue_comment workflows#26037
gh pr checkout failing with GH_HOST mismatch in issue_comment workflows#26037Conversation
…ERVER_URL
When the DIFC proxy is active, start_difc_proxy.sh sets GH_HOST=localhost:18443
in GITHUB_ENV. This causes `gh pr checkout` to fail because GH_HOST doesn't
match any git remote (origin points to github.com or a GHE host).
Fix: derive the correct GH_HOST from GITHUB_SERVER_URL and pass it as an env
override when calling `exec.exec("gh", ["pr", "checkout", ...])`. This ensures:
- DIFC proxy's localhost:18443 GH_HOST is overridden with the real GitHub host
- GHES hosts correctly use their actual hostname
- github.com uses github.com
Also adds new tests for the GH_HOST override behavior and updates existing
test expectations to match the new 3-argument exec.exec call.
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/55bc2334-76f1-49a8-9009-1219a7a6cf87
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
…ests Agent-Logs-Url: https://github.com/github/gh-aw/sessions/55bc2334-76f1-49a8-9009-1219a7a6cf87 Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with gh pr checkout for forked PRs
Fix Apr 13, 2026
gh pr checkout failing with GH_HOST mismatch in issue_comment workflows
Contributor
|
Hey The change is tightly scoped to This PR looks ready for maintainer review. 🚀
|
This was referenced Apr 13, 2026
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.
When the DIFC proxy is active,
start_difc_proxy.shsetsGH_HOST=localhost:18443inGITHUB_ENV. TheCheckout PR branchstep runs beforestop_difc_proxy.sh, sogh pr checkoutfails becauseGH_HOST=localhost:18443doesn't match any git remote (originpoints togithub.comor a GHE host).Changes
checkout_pr_branch.cjs: DeriveGH_HOSTfromGITHUB_SERVER_URLand pass it as an explicit env override when invokinggh pr checkout, bypassing any stale or proxy-overridden value:Covers all cases:
github.com, GHES (myorg.ghe.com), and DIFC proxy active (overrideslocalhost:18443).checkout_pr_branch.test.cjs: Updated allgh pr checkoutcall expectations to assert the env override is present; addedGITHUB_SERVER_URLtobeforeEach/afterEach; added 4 new tests covering DIFC proxy override, GHES host, protocol stripping, and missing-env fallback.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:
invalid.example.invalid/usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git git conf�� user.name lure tions/setup/js/node_modules/.bin/git -M main /usr/sbin/git git init�� --bare --initial-branch=main k/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/git '/tmp/bare-incregit '/tmp/bare-increadd cal/bin/git git(dns block)/usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git git comm�� -m lure test commit k/node_modules/.bin/git -b main ode-gyp-bin/git git conf�� user.email test@test.com /git -b feature-branch it git(dns block)If you need me to access, download, or install something from one of these locations, you can either: