Regardless of project, I'd like to know if there's an easy way of getting all commits to all public repositories for a single username.
Since I belong to multiple organizations, I'm trying to compile a list of the projects on which I'm a contributor, as well as projects that I have accepted pull requests.
So far my google-fu and looking through the github api docs has proved insufficient.
As long as people have access to the git repo, anyone can see any commit and any changes on there.
http://zmoazeni.github.com/gitspective/ is your friend. :-) Filter out all but "Push", and you have your view, albeit without the coding work to implement it yourself first.
Inspecting what goes on with the Chrome Devtools "Network" tab might help you mimic the API queries, if you want to redo the work yourself.
The correct way to do this is via the Events API.
First you need to fetch the user's events:
GET /users/:username/events
Then you will want to filter the response array for items where type
is set to PushEvent
. Each one of these items corresponds to a git push
by the user. The commits from that push are available in reverse chronological order in the payload.commits
array.
The next step is to filter out commits made by other users by checking the author.email
property of each commit object. You also have access to properties like sha
, message
and url
on the same object, and you can eliminate duplicate commits across multiple pushes by using the distinct
property.
EDIT: As pointed out by Adam Taylor in the comments, this approach is wrong. I failed to RTFM, sorry. The API lets you fetch at most 300 events and events are also limited to the last 90 days. I'll leave the answer here for completeness but for the stated question of fetching all commits, it won't work.
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