shurcooL / githubv4

Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add reviewers to PR

matttrach opened this issue · comments

Need the ability to get and set requested reviewers on PRs similar to labels.

{
  repository(owner: "k3s-io", name: "k3s") {
    id
    pullRequest(number: 7426) {
      id
      reviewRequests(first: 10) {
        totalCount
        nodes {
          requestedReviewer {
            ... on Team {
              combinedSlug
            }
            ... on User {
              email
            }
          }
        }
      }
    }
  }
}

Review requests is an ephemeral value, it disappears once someone adds a review.
Requested Reviewer does not make it into the auto-generated functions.

Getting requested reviewers should be a a matter of passing a variable that corresponds to that GraphQL query as shown at https://github.com/shurcooL/githubv4#simple-query.

To set requested reviewers, it'll be a GraphQL mutation as shown at https://github.com/shurcooL/githubv4#mutations. See GitHub docs at https://docs.github.com/en/graphql/reference/mutations#requestreviews and you can use the corresponding githubv4.RequestReviewsInput input type.

I'm not sure what you mean about the ephemeral value. Is there a problem you're running into, and if so, how can it be reproduced?