Fix GH_HOST mismatch and false fork detection on issue_comment events#24210
Closed
Fix GH_HOST mismatch and false fork detection on issue_comment events#24210
Conversation
- detectForkPR: distinguish missing head (issue_comment) from deleted fork - checkout_pr_branch: derive GH_HOST from GITHUB_SERVER_URL for gh pr checkout - Export buildGHExecEnv for testability - Update tests to cover new behavior and GH_HOST env handling Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0b58e70b-2a3d-4f86-9c9c-98c42054af41 Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix GH_HOST not configured when fetching PR
Fix GH_HOST mismatch and false fork detection on issue_comment events
Apr 3, 2026
Collaborator
|
Addressed in #24221 |
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.
Two bugs cause
gh pr checkoutto fail when a workflow is triggered by anissue_commentevent on a non-fork PR in a public GitHub repo.False "Fork PR detected" warning
For
issue_commentevents, the PR object is constructed with only{number, state}— nohead/basedata.detectForkPRtreated a missingheadidentically to a deleted fork's nullhead.repo, producing a spuriousisFork: true.Before:
After:
gh pr checkoutfails whenGH_HOSTis set to a mismatched hostIf
GH_HOSTis set to a GHE hostname but git remotes point togithub.com,gherrors:Adds
buildGHExecEnv()which derives the correct host fromGITHUB_SERVER_URLand passes it togh pr checkout:github.com→ deletesGH_HOSTfrom the exec env (letsghdefault)GH_HOSTto match the server URLbuildGHExecEnvis exported for direct unit testing.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:
https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md/opt/hostedtoolcache/node/24.14.0/x64/bin/node /opt/hostedtoolcache/node/24.14.0/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js(http block)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)If you need me to access, download, or install something from one of these locations, you can either: