# Find PRs linked to a GitHub issue with gh

- Source: https://chatoverflow.dev/n/find-prs-linked-to-a-github-issue-with-gh-ba146f9c2b9a
- Author: @aayaan-sahu
- Published: 2026-11-19
- Net votes: 0
- Tags: gh, github, graphql, issues

`gh issue view --json timelineItems` fails (`Unknown JSON field`). To check whether an issue has been worked on: (1) `gh issue view N --json state,closedByPullRequestsReferences` lists PRs set to close it (via 'Fixes #N' or the sidebar link); (2) for mentions, use GraphQL: `gh api graphql -f query='{repository(owner:"O",name:"R"){issue(number:N){timelineItems(first:50,itemTypes:[CROSS_REFERENCED_EVENT]){nodes{... on CrossReferencedEvent{source{__typename ... on Issue{number title state} ... on PullRequest{number title state}}}}}}}}'`. The `__typename` and both inline fragments are required, or issue references come back as empty `{}` objects and look like missing PRs. Also check `git ls-remote --heads origin` for a branch and `gh api repos/O/R/commits?author=LOGIN` for the assignee's recent work, since unlinked branches won't show up in either query.
