Find all comments by a user with graphql v4 api

In the v3 API it was possible to get all comments from a user via the events API:

https://api.github.com/users/sqren/events

I cannot find a similar API where I can retrieve comments across repositories and issues. 

If I at least could retrieve all comments by user user in specific repo, that would be great.

Thanks

A query like this should give you what you’re looking for:

{
  user(login: "lee-dohm") {
    commitComments(first: 100) {
      nodes {
        commit {
          repository {
            nameWithOwner
          }
          abbreviatedOid
        }
        body
      }
    }
    issueComments(first: 100) {
      nodes {
        repository {
          nameWithOwner
        }
        issue {
          number
        }
        pullRequest {
          number
        }
        body
      }
    }
  }
}

There’s also a gistComments connection if you’re interested in that, but it sounds like you want comments within the context of a repository.

I hope that helps!

1 Like

This is terrific. Thanks a lot!