Created
May 10, 2014 14:04
-
-
Save dfinke/328a511d03f41bcb88b3 to your computer and use it in GitHub Desktop.
Use PowerShell to list GitHub events that a user has received
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
function Get-GithubEvent { | |
param($userId,$Password) | |
function Get-GitHubAuthHeaders { | |
param($userId,$Password) | |
$authInfo = "$($userId):$($Password)" | |
$authInfo = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($authInfo)) | |
@{ | |
"Authorization" = "Basic " + $authInfo | |
"Content-Type" = "application/json" | |
} | |
} | |
$Headers = Get-GitHubAuthHeaders $userId $Password | |
$Uri = "https://api.github.com/users/$userId/received_events" | |
ForEach($item in (Invoke-RestMethod -Headers $Headers -Uri $Uri )) { | |
[PSCustomObject]@{ | |
Action = $item.payload.action | |
Type = $item.type | |
Who = $item.actor.login | |
Details = $item | |
} | |
} | |
} |
Author
dfinke
commented
May 10, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment