get, via GitHub API, all public repos a GitHub user has made commit(s) to



Even though on the forum page there is the following:

… if you’re looking for support for the REST API v3, please contact support.

I was asked to post my question here by the Community Manager, nadiajoyce

For a GitHub user foo, is it possible, via the GitHub v[3|4] API, to get all the public repos user foo has made commit(s) to?



Hey @hseuming

We’ll be shipping something to do this very soon to our GraphQL API. I’ll update this thread when it’s shipped :slight_smile:



We’ve just finished shipping the new User.repositoriesContributedTo endpoint. You can see why we’ve made this endpoint here: Deprecation and Replacement of User.contributedRepositories

To get the data you want, you could write a query like this:

  user(login: "foo"){
    repositoriesContributedTo(first: 100, contributionTypes: [COMMIT]){

Let me know if this works :slight_smile:


Hi @d12,
Thank you for your input. I was sidetracked by a few other tasks and had no previous exposure to GraphQL thus my late reply. After reading up on GraphQL and the Explorer, I was able to cook up some queries to get the results I was looking for.

One quick question: since “first” is limited to 100, how can one fetch all the results if there are more than 100 of them? The “offset” argument does not seem to get me anywhere as the error message below indicates.

In general, what is the proper way for pagination to fetch all the chunks?


user(login: “foo”) {
repositoriesContributedTo(first: 100 offset: 100, contributionTypes: [COMMIT]) {
edges {
node {


“data”: null,
“errors”: [
“message”: “Field ‘repositoriesContributedTo’ doesn’t accept argument ‘offset’”,
“locations”: [
“line”: 3,
“column”: 42


Hi @hseuming,

Our GraphQL API uses cursor based pagination, as opposed to offset based pagination like you’re trying.

You can learn more about cursor based pagination here:

Let me know if you have any questions!


Hi @d12,
Thanks again for your input. I’ll switch to cursor-based pagination to see how it goes.

One more related question: earlier you mentioned that I can use

   repositoriesContributedTo(first: 100, contributionTypes: [COMMIT]){ ..

to get all the public repos that a user has made commit(s) to and that works pretty well.

If instead I have

repositoriesContributedTo(first: 100, contributionTypes: [COMMIT, ISSUE]){ …

does [COMMIT, ISSUE] indicate boolean AND or OR? I mean, does [COMMIT, ISSUE] denote all the public repos that a given user

  1. has made commit(s) to AND raised issue(s) in or
  2. has made commit(s) to OR raised issue(s) in

Could you please point me to pertinent docs or the code/implementation for the intended semantics?



The endpoint documentation is here:

If non-null, include only the specified types of contributions.

So by specifying [COMMIT, ISSUE], you’re getting COMMIT contributions and ISSUE contributions.

Hope that helps!


Hi @d12,
Thanks again for the prompt response.

One more quick question: it appears that we can NOT get all contributors
(not collaborators) of a public repo with the v4 GraphQL API, right? i
know that can be done with the v3 REST-ful API (with pagination, if



No worries @hseuming!

We’ve actually been discussions contributors lately, we’re working on designing the schema around the feature. I don’t know when it will be released, but it’s in the works! I’ll update you here when this ships.


Hi @d12,
Thank you for all your timely assistance. Please kindly keep me posted.