Created
June 4, 2014 14:35
-
-
Save shiftkey/8f42142a52338950df08 to your computer and use it in GitHub Desktop.
octokit.net list off contributors who have had a pull requests merged into a repository
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
var client = new GitHubClient(new Octokit.ProductHeaderValue("NDC-Oslo")) | |
{ | |
Credentials = new Credentials("some-username", "some-password") | |
}; | |
// find all merged PRs | |
var filter = new PullRequestRequest() { State = ItemState.Closed }; | |
var pullRequests = await client.Repository.PullRequest.GetForRepository("octokit", "octokit.net", filter); | |
Console.WriteLine("Pull Requests: " + pullRequests.Count); | |
var contributors = pullRequests.Where(x => x.MergedAt.HasValue) | |
.GroupBy(x => x.User.Login) | |
.Select(x => new { Key = x.Key, Count = x.Count() }) | |
.OrderByDescending(x => x.Count); | |
Console.WriteLine("Contributors: " + contributors.Count()); | |
Console.WriteLine(); | |
foreach(var contributor in contributors) | |
{ | |
Console.WriteLine("{0} has {1} merged PRs", contributor.Key, contributor.Count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment