Teach ServicingPipeline to paginate project board items (#18328)

Oops, it didn't support more than 100 items!

(cherry picked from commit 3e6690290f5d6d92d0a52edcae20bc55e1138082)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgWLtrU
Service-Version: 1.22
This commit is contained in:
Dustin L. Howett 2025-01-08 13:35:40 -08:00 committed by Dustin Howett
parent 8ed73b1473
commit 0e5fbad0f6

View File

@ -105,48 +105,59 @@ Function Get-GraphQlProjectNumberGivenName($Organization, $Name) {
Function Get-GraphQlProjectWithNodes($Organization, $Number) { Function Get-GraphQlProjectWithNodes($Organization, $Number) {
# It's terrible, but it pulls *all* of the info we need all at once! # It's terrible, but it pulls *all* of the info we need all at once!
$Project = Invoke-GitHubGraphQlApi -Query ' $cursor = ""
query($organization: String! $number: Int!) { $hasMore = $true
organization(login: $organization) { $nodes = @()
projectV2(number: $number) { While ($hasMore) {
id $Project = Invoke-GitHubGraphQlApi -Query '
number query($organization: String!, $number: Int!, $after: String) {
title organization(login: $organization) {
fields(first:20){ projectV2(number: $number) {
nodes { id
... on ProjectV2FieldCommon { id name } number
... on ProjectV2SingleSelectField { options { id name } } title
} fields(first:20){
} nodes {
items { ... on ProjectV2FieldCommon { id name }
nodes { ... on ProjectV2SingleSelectField { options { id name } }
id
status: fieldValueByName(name: "Status") {
... on ProjectV2ItemFieldSingleSelectValue { name }
} }
content { }
... on Issue { items(first: 100, after: $after) {
number pageInfo { hasNextPage endCursor }
closedByPullRequestsReferences(first: 8) { nodes {
... on PullRequestConnection { id
nodes { status: fieldValueByName(name: "Status") {
number ... on ProjectV2ItemFieldSingleSelectValue { name }
mergeCommit { oid } }
content {
... on Issue {
number
closedByPullRequestsReferences(first: 8) {
... on PullRequestConnection {
nodes {
number
mergeCommit { oid }
}
} }
} }
} }
} ... on PullRequest {
... on PullRequest { number
number mergeCommit { oid }
mergeCommit { oid } }
} }
} }
} }
} }
} }
} }
' -Variables @{ organization = $Organization; number = $Number; after = $cursor }
$n += $Project.organization.projectV2.items.nodes
$cursor = $Project.organization.projectV2.items.pageInfo.endCursor
$hasMore = $Project.organization.projectV2.items.pageInfo.hasNextPage
} }
' -Variables @{ organization = $Organization; number = $Number } $Project.organization.projectV2.items.nodes = $n
$Project $Project
} }