The gh-address-comments skill's scripts/fetch_comments.py seems to break on cross-repo PRs from a fork.
I hit this on JanDeDobbeleer/oh-my-posh#7582, where the PR head repo is my fork Nick2bad4u/oh-my-posh.
What happened:
Command failed: gh api graphql -F query=@- -F owner=Nick2bad4u -F repo=oh-my-posh -F number=7582
gh: Could not resolve to a PullRequest with the number of 7582.
The script calls:
pr = gh_pr_view_json("number,headRepositoryOwner,headRepository")
owner = pr["headRepositoryOwner"]["login"]
repo = pr["headRepository"]["name"]
number = int(pr["number"])
That works for same-repo PRs, but for fork PRs the PR number belongs to the base repository, not the head repository. In this case it tries to query Nick2bad4u/oh-my-posh#7582, but the actual PR is JanDeDobbeleer/oh-my-posh#7582.
Expected behavior:
The script should query the base repo for the PR, even when the current branch is from a fork. Something like reading the PR URL/base repository from gh pr view or using the base repo owner/name would avoid this.
I worked around it by querying GraphQL directly against JanDeDobbeleer/oh-my-posh#7582, and that returned the review threads correctly.
The
gh-address-commentsskill'sscripts/fetch_comments.pyseems to break on cross-repo PRs from a fork.I hit this on
JanDeDobbeleer/oh-my-posh#7582, where the PR head repo is my forkNick2bad4u/oh-my-posh.What happened:
The script calls:
That works for same-repo PRs, but for fork PRs the PR number belongs to the base repository, not the head repository. In this case it tries to query
Nick2bad4u/oh-my-posh#7582, but the actual PR isJanDeDobbeleer/oh-my-posh#7582.Expected behavior:
The script should query the base repo for the PR, even when the current branch is from a fork. Something like reading the PR URL/base repository from
gh pr viewor using the base repo owner/name would avoid this.I worked around it by querying GraphQL directly against
JanDeDobbeleer/oh-my-posh#7582, and that returned the review threads correctly.