@@ -105,48 +105,59 @@ Function Get-GraphQlProjectNumberGivenName($Organization, $Name) {
105
105
106
106
Function Get-GraphQlProjectWithNodes ($Organization , $Number ) {
107
107
# It's terrible, but it pulls *all* of the info we need all at once!
108
- $Project = Invoke-GitHubGraphQlApi - Query '
109
- query($organization: String! $number: Int!) {
110
- organization(login: $organization) {
111
- projectV2(number: $number) {
112
- id
113
- number
114
- title
115
- fields(first:20){
116
- nodes {
117
- ... on ProjectV2FieldCommon { id name }
118
- ... on ProjectV2SingleSelectField { options { id name } }
119
- }
120
- }
121
- items {
122
- nodes {
123
- id
124
- status: fieldValueByName(name: "Status") {
125
- ... on ProjectV2ItemFieldSingleSelectValue { name }
108
+ $cursor = " "
109
+ $hasMore = $true
110
+ $nodes = @ ()
111
+ While ($hasMore ) {
112
+ $Project = Invoke-GitHubGraphQlApi - Query '
113
+ query($organization: String!, $number: Int!, $after: String) {
114
+ organization(login: $organization) {
115
+ projectV2(number: $number) {
116
+ id
117
+ number
118
+ title
119
+ fields(first:20){
120
+ nodes {
121
+ ... on ProjectV2FieldCommon { id name }
122
+ ... on ProjectV2SingleSelectField { options { id name } }
126
123
}
127
- content {
128
- ... on Issue {
129
- number
130
- closedByPullRequestsReferences(first: 8) {
131
- ... on PullRequestConnection {
132
- nodes {
133
- number
134
- mergeCommit { oid }
124
+ }
125
+ items(first: 100, after: $after) {
126
+ pageInfo { hasNextPage endCursor }
127
+ nodes {
128
+ id
129
+ status: fieldValueByName(name: "Status") {
130
+ ... on ProjectV2ItemFieldSingleSelectValue { name }
131
+ }
132
+ content {
133
+ ... on Issue {
134
+ number
135
+ closedByPullRequestsReferences(first: 8) {
136
+ ... on PullRequestConnection {
137
+ nodes {
138
+ number
139
+ mergeCommit { oid }
140
+ }
135
141
}
136
142
}
137
143
}
138
- }
139
- ... on PullRequest {
140
- number
141
- mergeCommit { oid }
144
+ ... on PullRequest {
145
+ number
146
+ mergeCommit { oid }
147
+ }
142
148
}
143
149
}
144
150
}
145
151
}
146
152
}
147
153
}
154
+ ' - Variables @ { organization = $Organization ; number = $Number ; after = $cursor }
155
+
156
+ $n += $Project.organization.projectV2.items.nodes
157
+ $cursor = $Project.organization.projectV2.items.pageInfo.endCursor
158
+ $hasMore = $Project.organization.projectV2.items.pageInfo.hasNextPage
148
159
}
149
- ' - Variables @ { organization = $Organization ; number = $Number }
160
+ $Project . organization.projectV2.items.nodes = $n
150
161
$Project
151
162
}
152
163
0 commit comments