Summary
Get-GitHubRepository appears to return only a single page when called without parameters (authenticated user's repositories).
Environment
- Host:
github.com
- Authenticated account:
MariusStorhaug
- Module:
GitHub 0.43.1
Reproduction
(Get-GitHubRepository).Count
Observed:
Additional check:
(Get-GitHubRepository -PerPage 50).Count
Observed:
This strongly suggests the command returns only the first page, respecting PerPage as page size but not iterating to next pages.
Expectation
- Calling
Get-GitHubRepository with no parameters should paginate through all pages and return the full set of repositories visible to the authenticated user.
Context
- The user profile indicates ~3.3k repositories, so a hard cap at exactly one page is likely unintended.
- In local source (
main) there appears to be pagination logic in the owner-list path, so this may be a runtime/release-path mismatch or a regression in the published module behavior.
Root cause analysis
Root cause found in Get-GitHubMyRepositories (the authenticated-user/no-parameter path used by Get-GitHubRepository).
The loop emits nodes correctly, but updates pagination state from an undefined $response variable:
$hasNextPage = $response.pageInfo.hasNextPage
$after = $response.pageInfo.endCursor
That leaves $hasNextPage false/null after the first request, so the do { ... } while ($hasNextPage) loop stops after exactly one page.
Suggested fix:
Invoke-GitHubGraphQLQuery @apiParams | ForEach-Object {
$_.viewer.repositories.nodes | ForEach-Object {
[GitHubRepository]::new($_)
}
$hasNextPage = $_.viewer.repositories.pageInfo.hasNextPage
$after = $_.viewer.repositories.pageInfo.endCursor
}
Validated locally against the psmodule-user context with 2500+ repositories:
Import-Module '/Users/marst/.local/share/powershell/Modules/GitHub/0.43.1/GitHub.psd1' -Force
Get-GitHubRepository -Context 'psmodule-user' -PerPage 100 | Measure-Object | Select-Object -ExpandProperty Count
Result: 2985 repositories, confirming the loop now walks all pages.
Summary
Get-GitHubRepositoryappears to return only a single page when called without parameters (authenticated user's repositories).Environment
github.comMariusStorhaugGitHub 0.43.1Reproduction
(Get-GitHubRepository).CountObserved:
Additional check:
Observed:
This strongly suggests the command returns only the first page, respecting
PerPageas page size but not iterating to next pages.Expectation
Get-GitHubRepositorywith no parameters should paginate through all pages and return the full set of repositories visible to the authenticated user.Context
main) there appears to be pagination logic in the owner-list path, so this may be a runtime/release-path mismatch or a regression in the published module behavior.Root cause analysis
Root cause found in
Get-GitHubMyRepositories(the authenticated-user/no-parameter path used byGet-GitHubRepository).The loop emits nodes correctly, but updates pagination state from an undefined
$responsevariable:That leaves
$hasNextPagefalse/null after the first request, so thedo { ... } while ($hasNextPage)loop stops after exactly one page.Suggested fix:
Validated locally against the
psmodule-usercontext with 2500+ repositories:Result:
2985repositories, confirming the loop now walks all pages.