The best way to control Claude Code, Codex and more from any computer or phone
| 1 | # The pull request reads behind `GitHubSourceControlProvider`. `PullRequestsByHead` is batched |
| 2 | # with `GraphQLResolver.aliased`, which repeats it under an alias per lookup, so the lookups a |
| 3 | # branch sweep makes together share one request and a missing repository fails only its own. |
| 4 | |
| 5 | # The pull request fields every read selects. |
| 6 | fragment PullRequestNode on PullRequest { |
| 7 | number |
| 8 | title |
| 9 | url |
| 10 | baseRefName |
| 11 | headRefName |
| 12 | headRefOid |
| 13 | state |
| 14 | isDraft |
| 15 | mergedAt |
| 16 | closedAt |
| 17 | updatedAt |
| 18 | isCrossRepository |
| 19 | headRepository { |
| 20 | name |
| 21 | nameWithOwner |
| 22 | } |
| 23 | headRepositoryOwner { |
| 24 | login |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | query PullRequestsByHead( |
| 29 | $owner: String! |
| 30 | $name: String! |
| 31 | $head: String! |
| 32 | $states: [PullRequestState!] |
| 33 | $first: Int! |
| 34 | ) { |
| 35 | repository(owner: $owner, name: $name) { |
| 36 | # `gh pr list` orders the same way, so a head with more matches than the limit keeps the |
| 37 | # same rows. |
| 38 | pullRequests( |
| 39 | headRefName: $head |
| 40 | states: $states |
| 41 | first: $first |
| 42 | orderBy: { field: CREATED_AT, direction: DESC } |
| 43 | ) { |
| 44 | nodes { |
| 45 | ...PullRequestNode |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | query PullRequestByNumber($owner: String!, $name: String!, $number: Int!) { |
| 52 | repository(owner: $owner, name: $name) { |
| 53 | pullRequest(number: $number) { |
| 54 | ...PullRequestNode |
| 55 | } |
| 56 | } |
| 57 | } |