Skip to content
Source
Sign inSign up
Open History to see the last commit

sourceControlProvider.graphql

57 lines1.3 KB

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.
6fragment 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 }
27​
28query 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 }
50​
51query PullRequestByNumber($owner: String!, $name: String!, $number: Int!) {
52 repository(owner: $owner, name: $name) {
53 pullRequest(number: $number) {
54 ...PullRequestNode
55 }
56 }