How to get all commits/Push of a user using V3 APIs

I want to get the list of all pulls/ commits that a user who has signed up for my app has made till now. I got something in Graphql: https://developer.github.com/v4/object/push/#implements 

, but it’s in preview period.

There is one pagination way to get all the user event for past 90 days or maximum of 300 events but it is not helpful as I need all the commits of push of a user since he signed in into Github

@vikrant-sahu wrote:

I want to get the list of all pulls/ commits that a user who has signed up for my app has made till now. I got something in Graphql: https://developer.github.com/v4/object/push/#implements 

, but it’s in preview period.

This sounds interesting but I’m not sure if something like that should even exist.

If you are not the organization/repo owner or the repo is not public, it’s not possible I believe. 

But I would still hope for someone knowledgeable to pitch in.
Did you try out that graphql api, what does it return?

@vikrant-sahu wrote:

I need all the commits of push of a user since he signed in into Github

To me this sounds really dangerous and serious. Why on earth would anyone allow you to peek into their commit history?

As a GitHub user, I would never want that to happen.

As far as I know, when searching for commits you have to provide a repository.

So you’ll need to seperate your search into 2 phases:

  1. Get all repositories that the user has comitted to.

  2. For each repository, get all the commits of that user in that repository.

For the 1st item you can use graphql API with the https://developer.github.com/v4/object/user/ query.

Check out the repositoriesContributedTo field that receives a https://developer.github.com/v4/enum/repositorycontributiontype/ which in your case should be COMMIT.

Once you have the repository names, you can use the REST API for the 2nd item - https://developer.github.com/v3/repos/commits/

Check out the _author _query parameter that will give you commits for that user only.

Hope that helps