api - 如何获得我在去年贡献的所有 GitHub 项目的列表?

标签 api events github

这个问题在这里已经有了答案:





GitHub API: Repositories Contributed To

(11 个回答)


5年前关闭。




我意识到我可以打 https://api.github.com/users/:user_id/repos获取我拥有或已经 fork 的所有 repo 的列表。但我想做的是弄清楚我在过去一年中贡献的所有项目(提交、拉取请求、问题等)。 events API让我获得最近的 300 个事件,但在过去的 12 个月中,我的贡献远不止这些。这可能吗?

最佳答案

感谢 a tweet来自 @caged , 我写了 this Perl scriptmy 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;

是的,HTML 抓取有点难看,但它满足了我的需求。

关于api - 如何获得我在去年贡献的所有 GitHub 项目的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21322778/

相关文章:

asp.net - 如何取消 ASP.net 中的事件冒泡?

android - 如何从 GitHub 上打开的 Umano 应用程序中包含 SlidingUpPanel?

java - Google 天气 API 条件

php - 使用 php 创建 api

json - 无法查询 OpenLibrary

C、Windows API在注册表项后创建文件夹结构

javascript - 当鼠标在 DOM 元素内移动时,如何防止执行 mouseover 函数 - Backbone Events

javascript - 在关闭选项卡/窗口事件上提交表单

git - 克隆 github 项目的一部分

Git pull 和推不起作用