How can I get ALL public repos I have contributed to? #24350
-
I tried using this GraphQL, but it only returns about 30 results with no further pagination:
I have checked that several normal, public contributions are missing. I expect a much longer list. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments
-
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! |
Beta Was this translation helpful? Give feedback.
-
Other ways to get help would me git- hub enterprises |
Beta Was this translation helpful? Give feedback.
-
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). |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
Hey…I was looking for the same. Did u get any other method to get all the contributions of a user in one go? |
Beta Was this translation helpful? Give feedback.
-
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)… |
Beta Was this translation helpful? Give feedback.
-
I just created a feature request to improve the user experience. You can show your support at #39589. |
Beta Was this translation helpful? Give feedback.
-
I just received the following response from GitHub support. The recently is defined as one year and the only way to get the total Thank you for contacting GitHub Support!
The repositoriesContributedTo connection returns "a list of repositories that the user recently contributed to," and the "recently" here is defined as "in the last year".
There isn't a way to get all contributions since GitHub was launched using the repositoriesContributedTo connection. I'd say the contributionsCollection connection is still the way to go, you'd need to filter out the user's own repositories as you noted in the discussion here. I have marked this ticket also as a feedback/feature request so it is visible to the Product team. Please note that while the Product team reads and evaluates all feedback, we cannot guarantee a response to every submission. We invite you to share your feedback in our official GitHub community discussions repository. |
Beta Was this translation helpful? Give feedback.
-
I just used the following to get some stats/data along these lines, albeit year by year, which has already been highlighted as a limitation # Run at https://docs.github.com/en/graphql/overview/explorer
{
viewer {
contributionsCollection(
from: "2024-01-01T00:00:00Z"
to: "2024-12-31T23:59:59Z"
) {
startedAt
endedAt
totalCommitContributions
totalRepositoriesWithContributedCommits
# if the `totalRepositoriesWithContributedCommits` number is greater than
# 100, the `maxRepositories` argument will need increasing, or the query
# will need splitting
commitContributionsByRepository(maxRepositories: 100) {
repository {
name
description
owner {
... on Organization {
name
resourcePath
url
}
... on User {
name
resourcePath
url
}
}
resourcePath
url
}
contributions {
totalCount
}
url
}
totalIssueContributions
totalRepositoriesWithContributedIssues
totalPullRequestContributions
totalRepositoriesWithContributedPullRequests
totalPullRequestReviewContributions
totalRepositoriesWithContributedPullRequestReviews
totalRepositoryContributions
contributionCalendar {
totalContributions
}
hasActivityInThePast
}
}
} |
Beta Was this translation helpful? Give feedback.
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 th…