'list contributions to any repositorie (not only owned ones) of a user in github

I have a very simple question. I am trying to figure out the repositories a github user has contributed to and I am unable. So for example in this account https://github.com/goodfeli. How can I check all the repositories this user has contributed to?

By clicking into repositories I can only list the repositories created by this user. Moreover, I know the pinned repositories can show any repository this user has contributed to but it can only list up to 6. So I can figure out how to list them all.



Solution 1:[1]

You can use the GraphQL API to get up to 100 repositories where a user contributed to for various categories. This displays repositories that are accessible by the token you are authenticating with.

Here is a query (replace octocat with the login of the user):

query {
  user(login: "octocat") {
    contributionsCollection {
      commitContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
        }
      }
      issueContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
        }
      }
      pullRequestReviewContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
        }
      }
      pullRequestContributionsByRepository(maxRepositories: 100) {
        repository {
          nameWithOwner
        }
      }
    }
  }
}

The simplest way is to use GitHub's GraphQL Explorer where you can refine/adjust your query.

The user you are mentioning in your question apparently has no contributions that are accessible with my authenticated user, thus the result is empty:

{
  "data": {
    "user": {
      "contributionsCollection": {
        "commitContributionsByRepository": [],
        "issueContributionsByRepository": [],
        "pullRequestReviewContributionsByRepository": [],
        "pullRequestContributionsByRepository": []
      }
    }
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1