How can I get ALL public repos I have contributed to?

I tried using this GraphQL, but it only returns about 30 results with no further pagination:

{
  viewer {
    repositoriesContributedTo(first: 100, contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]) {
      nodes {
        nameWithOwner
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

I have checked that several normal, public contributions are missing.  I expect a much longer list.

The documentation of that connection states that it is: “A list of repositories that the user recently contributed to.” (emphasis mine) If you want a list of everything, you would have to use the search functionality and create the list of public repositories from the various results types you retrieved from the search APIs.

I hope that helps!

1 Like

Other ways to get help would me git- hub enterprises

Can you please give some more information about what ‘recently’ entails? Is there a time period that GitHub uses to determine ‘recently’? Also, regarding your suggestion about using the search functionality, can you pls give some more details about the implementation you had in mind for retrieving every repository a user has contributed to since the beginning of time? I’m wary of abusing the search functionality if I implement it the wrong way for doing something as lightweight as getting a list of repositories. 

Thank you!

Edit: I played around with User.contributionsCollection, but found that it only accepts 1-year long intervals, which would mean I’d have to make as many requests as the number of years the user has made contributions (using contributionsCollection.hasActivityInThePast), or at most ~11 requests (since GitHub was founded in 2008). 

3 Likes

Unfortunately, no, I don’t have any other information beyond “recently”. Whatever the window is, whether it is a span of time, the most recent X results, or some other metric, it isn’t “everything”.

As for being wary of abusing the search functionality, working within the rate limits is a good first step :grinning: But it sounds like you’ve got a good solution there with User.contributionsCollection. Let us know how it works out!

1 Like

Hey…I was looking for the same. Did u get any other method to get all the contributions of a user in one go? 

Interested in the about the same thing, I’m trying to find the most starred repository an user has contributed to (from the beginning of the account)…