Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 5

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

Solved! Go to Solution.

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.

4 Replies
Community Manager
Message 2 of 5

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

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!

Ground Controller Lvl 1
Message 3 of 5

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

Other ways to get help would me git- hub enterprises
Solution
Copilot Lvl 2
Message 4 of 5

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

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). 

Community Manager
Message 5 of 5

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

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 😀 But it sounds like you've got a good solution there with `User.contributionsCollection`. Let us know how it works out!