Created
March 11, 2022 13:45
-
-
Save jenol/9e8c8f6a251d8b0282a7341833d241f6 to your computer and use it in GitHub Desktop.
This file contains 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
$ErrorActionPreference = "Stop" | |
$githubAuth = "get your own token" | |
$organization = "your org" | |
$repoName = "your repo" | |
$repo = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$organization/$repoName" -Headers @{ | |
Authorization = "bearer $githubAuth" | |
Accept = "application/vnd.github.v3+json" | |
} -Body $body -UseBasicParsing | |
$mainBranchName = $repo.default_branch | |
$mainBranch = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$organization/$repoName/branches/$mainBranchName" -Headers @{ | |
Authorization = "bearer $githubAuth" | |
Accept = "application/vnd.github.v3+json" | |
} -Body $body -UseBasicParsing | |
$trees = Invoke-RestMethod -Method Get -Uri "https://api.github.com/repos/$organization/$repoName/git/trees/$($mainBranch.commit.sha)?recursive=1" -Headers @{ | |
Authorization = "bearer $githubAuth" | |
Accept = "application/vnd.github.v3+json" | |
} -Body $body -UseBasicParsing | |
$trees.truncated | |
$trees.tree |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment