Skip to content

Commit 217e81e

Browse files
committed
GitHub API
1 parent fd53712 commit 217e81e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

git/github-api.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Clear-Host
2+
$PersonalAccessToken = "github_pat_[your_personal_access_token]"
3+
4+
$GitHubApiUrl = "https://api.github.com/user/repos"
5+
# $GitHubApiUrl = "https://api.github.com/orgs/PowerShellLibrary/repos"
6+
# $GitHubApiUrl = "https://api.github.com/repositories"
7+
8+
$Headers = @{
9+
Authorization = "token $PersonalAccessToken"
10+
"User-Agent" = "PowerShell" # GitHub API requires a User-Agent header
11+
}
12+
13+
$response = Invoke-RestMethod -Uri $GitHubApiUrl -Method Get -Headers $Headers
14+
$response

0 commit comments

Comments
 (0)