I realize I can hit https://api.github.com/users/:user_id/repos
to get a list of all the repos I own or have forked. But what I would like to do is figure out all of the projects I have contributed to (commits, pull requests, issues, etc.) over the last year. The events API lets me get the last 300 events, but I have contributed a lot more than that in the last twelve months. Is this possible?
On GitHub, you can see the commit history of a repository by: Navigating directly to the commits page of a repository. Clicking on a file, then clicking History, to get to the commit history for a specific file.
Your local Git commit email isn't connected to your account Commits must be made with an email address that is connected to your account on GitHub.com, or the GitHub-provided noreply email address provided to you in your email settings, in order to appear on your contributions graph.
Thanks to a tweet from @caged, I wrote this Perl script to iterate over months in my contributions:
use v5.12; use warnings; use utf8; my $uname = 'theory'; my %projects; for my $year (2012..2014) { for my $month (1..12) { last if $year == 2014 && $month > 1; my $from = sprintf '%4d-%02d-01', $year, $month; my $to = sprintf '%4d-%02d-01', $month == 12 ? ($year + 1, 1) : ($year, $month + 1); my $res = `curl 'https://github.com/$uname?tab=contributions&from=$from&to=$to' | grep 'class="title"'`; while ($res =~ /href="([^"?]+)/g) { my (undef, $user, $repo) = split m{/} => $1; $projects{"$user/$repo"}++; } } } say "$projects{$_}: $_" for sort keys %projects;
Yeah, HTML scraping is kind of ugly, but did the trick for my needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With