Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 3

Find all comments by a user with graphql v4 api

Solved! Go to Solution.

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

2 Replies
Solution
Community Manager
Message 2 of 3

Re: Find all comments by a user with graphql v4 api

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!

Copilot Lvl 3
Message 3 of 3

Re: Find all comments by a user with graphql v4 api

This is terrific. Thanks a lot!