Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get a list of all github `PushEvents` for a user

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",

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.

like image 647
Aras Avatar asked Sep 11 '13 05:09

Aras


1 Answers

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>');
    });
  }
});

Or:

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.

like image 91
VonC Avatar answered Oct 13 '22 21:10

VonC