Skip to content

Instantly share code, notes, and snippets.

@AfroThundr3007730
Created October 9, 2023 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AfroThundr3007730/d96e402653ab1786d1bcb2ac71df4630 to your computer and use it in GitHub Desktop.
Save AfroThundr3007730/d96e402653ab1786d1bcb2ac71df4630 to your computer and use it in GitHub Desktop.
Gets a list of repositories of a GitHub user
function Get-GHRepoList {
<# .SYNOPSIS
Gets a list of repositories of a GitHub user. #>
Param(
# User to enumerate
[string]$User,
# Page size to request
[int]$Size = 100
)
$page = 0
$count = (Invoke-RestMethod -Uri ('https://api.github.com/users/{0:s}' -f $User)).public_repos
do {
$page++
(Invoke-RestMethod -Uri ('https://api.github.com/users/{0:s}/repos?page={1:d}&per_page={2:d}' -f $User, $page, $Size)).html_url
Start-Sleep -Seconds 1
} while ($page * $size -lt $count)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment