Last active
December 6, 2019 16:36
-
-
Save ljtill/dc4c6f508a22b2d147ac1ed9a8bd202e to your computer and use it in GitHub Desktop.
Provides the ability to clone all GitHub repositories of an owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Invoke-GitHubRepositoriesClone { | |
| [CmdletBinding()] | |
| param ( | |
| [Parameter()] | |
| [string]$PersonalAccessToken | |
| ) | |
| begin { | |
| $request = @{ | |
| Method = "GET" | |
| Uri = "https://api.github.com/user/repos?affiliation=owner" | |
| Headers = @{ | |
| "Authorization" = ("token " + $personalAccessToken) | |
| "Accept" = "application/vnd.github.v3+json" | |
| } | |
| Body = $null | |
| } | |
| } | |
| process { | |
| $response = Invoke-RestMethod @request | |
| $response | ForEach-Object { | |
| git clone $_.git_url | |
| } | |
| } | |
| end { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment