Teach ServicingPipeline to paginate project board items (#18328)

Oops, it didn't support more than 100 items!
This commit is contained in:
Dustin L. Howett 2025-01-08 13:35:40 -08:00 committed by GitHub
parent a3a4464667
commit 3e6690290f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,8 +105,12 @@ 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!
$cursor = ""
$hasMore = $true
$nodes = @()
While ($hasMore) {
$Project = Invoke-GitHubGraphQlApi -Query ' $Project = Invoke-GitHubGraphQlApi -Query '
query($organization: String! $number: Int!) { query($organization: String!, $number: Int!, $after: String) {
organization(login: $organization) { organization(login: $organization) {
projectV2(number: $number) { projectV2(number: $number) {
id id
@ -118,7 +122,8 @@ Function Get-GraphQlProjectWithNodes($Organization, $Number) {
... on ProjectV2SingleSelectField { options { id name } } ... on ProjectV2SingleSelectField { options { id name } }
} }
} }
items { items(first: 100, after: $after) {
pageInfo { hasNextPage endCursor }
nodes { nodes {
id id
status: fieldValueByName(name: "Status") { status: fieldValueByName(name: "Status") {
@ -146,7 +151,13 @@ Function Get-GraphQlProjectWithNodes($Organization, $Number) {
} }
} }
} }
' -Variables @{ organization = $Organization; number = $Number } ' -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
}
$Project.organization.projectV2.items.nodes = $n
$Project $Project
} }