githubgithub-apipull-requestusabilitygithub-codereviews

Is it possible to get all my GitHub code review comments?


GitHub provides quite a convenient API (REST, v3) to see everything on repository level. To see one's comments on code review, I need to know which repositories were reviewed by him/her and crawl all PRs in these repositories. However, sometimes I don't remember all repositories where I was doing code review. If I need to find some particular comment, it would be quite tedious to remember in which repository it was.

So, is there any more convenient way to search through someone's code review comments effectively?


Solution

  • This is not convenient with GitHub REST API v3.

    This is more convenient with GitHub GraphQL API v4, as shown here:

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

    You can test it directly in the GraphQL Explorer.