如何为用户获取所有github`PushEvents`的列表 [英] How can I get a list of all github `PushEvents` for a user

查看:40
本文介绍了如何为用户获取所有github`PushEvents`的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以看到特定用户的所有事件,例如,这是我的:

I can see all events for a particular user, for example here are mine:

https://api.github.com/users/arasbm/events

但是我只对特定类型的事件感兴趣:

But I am only interested in events of a particular type:

"type": "PushEvent",

如何获取这些数据而不必处理所有事件的列表(这可能很慢).我正在尝试执行此操作,因为我想获取所有已合并的PR的列表.如果您可以给我curl命令,那将非常棒.我无法在github api文档中的任何地方找到它.

How can I get this data without having to process the list of all events (which can be slow). I am trying to do this because I want to get a list of all my PRs that have been merged. If you can give me the curl command that would be awesome. I can not find this anywhere in the github api docs.

推荐答案

如"中确认的那样框架?",则必须过滤JSON /users/username/events 响应.

As confirmed in "How do I get notifications for commits to the framework?", you would have to filter the JSON /users/username/events response.

$.each(data.data, function(key, val) {
  if (val.type == "PushEvent") {
    $.each(val.payload.commits, function(key2, val2) {
      list.append('<li id="' + val2.sha + '"><a href="https://github.com/UnionOfRAD/lithium/commit/' + val2.sha + '">' + val2.message + '</a> [' + val.actor.login + ' @ ' + val.created_at + ']</li>');
    });
  }
});

或者:

您可以监视提交RSS提要(如"设置Github提交RSS提要":

You can monitor the commit RSS feed (as in "Setting up an Github Commit RSS feed":

https://github.com/user/repo/commits/master.atom
# more general url:
https://github.com/user/repo/commits/branch_name.atom?login=login&token=token

但是那将是一个用户的一个回购,而不是所有用户的回购.

But that would be for one repo of one user though, not for all the user repos.

这篇关于如何为用户获取所有github`PushEvents`的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆