filter history by author

I’m trying to fetch all commits of one author for a given repository.

user(login: "nikhedonia") {  
  databaseId # = 4670055  
}  
repository(owner: "loopperfect", name: "buckaroo") {  
  nameWithOwner  
  defaultBranchRef {  
    name  
    target {  
    ... on Commit {  
      history(author: {id:4670055}) {  
        totalCount  
      }  
    }  
  }  
}  

Unfortunately I recieve the following error:

"errors": [  
{  
"type": "NOT\_FOUND",  
"path": [  
"repository",  
"defaultBranchRef",  
"target",  
"history",  
"totalCount"  
],  
"locations": [  
{  
"line": 18,  
"column": 13  
}  
],  
"message": "Could not resolve to a node with the global id of '4670055'"  
}  
]  

What ID am I supposed to use?

btw. Google Indexed this link: https://platform.github.community/t/filter-repository-history-by-login-instead-of-id/4592 but it seems to be out of date

Hi @nikhedonia,

Thanks for being here! That link from google is for the old platform board, it has since migrated here you can read more about it here.

Here is a sample query that might help:

{
  repository(name: "andreagriffiths11.me", owner: "andreagriffiths11") {
    ref(qualifiedName: "master") {
      target {
        ... on Commit {
          id
          history(first: 100) {
            pageInfo {
              hasNextPage
            }
            edges {
              node {
                messageHeadline
                oid
                message
                author {
                  name
                  email
                  date
                }
              }
            }
          }
        }
      }
    }
  }
}

Thanks for your quick reply.

Your example iterates through the first 100 commits.

The docs mention that you can filter the commits by author_id and/or author_email

Unfortunately all my attempts of filtering by author_id  caused a fatal error:

> Could not resolve to a node with the global id of ‘4670055’

This does not seem right to me.

> That link from google is for the old platform board

Are the old posts still accesible?

The link https://platform.github.community/t/filter-repository-history-by-login-instead-of-id/4592 and googles teaser seem to be realated to my problem.

Unfortunately I was not able to find the original post neither using google or the the searchfunction of this community forum

@nikhedonia It looks like you are currently trying to filter by a databaseId. Instead you should filter by the user id. You can get the user id if you know the username like:

{
  user(login: "nikhedonia") {
    id # MDQ6VXNlcjQ2NzAwNTU=
  }
}

The user id for the username “nikhedonia” is “MDQ6VXNlcjQ2NzAwNTU=”. You can now filter commits by user id:

history(first: 5, author: {id: "MDQ6VXNlcjQ2NzAwNTU="}) {
1 Like