MCPcopy
hub / github.com/cli/cli / AddReview

Function AddReview

api/queries_pr_review.go:248–273  ·  view source on GitHub ↗
(client *Client, repo ghrepo.Interface, pr *PullRequest, input *PullRequestReviewInput)

Source from the content-addressed store, hash-verified

246func (r ReviewerTeam) sealedReviewerCandidate() {}
247
248func AddReview(client *Client, repo ghrepo.Interface, pr *PullRequest, input *PullRequestReviewInput) error {
249 var mutation struct {
250 AddPullRequestReview struct {
251 ClientMutationID string
252 } `graphql:"addPullRequestReview(input:$input)"`
253 }
254
255 state := githubv4.PullRequestReviewEventComment
256 switch input.State {
257 case ReviewApprove:
258 state = githubv4.PullRequestReviewEventApprove
259 case ReviewRequestChanges:
260 state = githubv4.PullRequestReviewEventRequestChanges
261 }
262
263 body := githubv4.String(input.Body)
264 variables := map[string]interface{}{
265 "input": githubv4.AddPullRequestReviewInput{
266 PullRequestID: pr.ID,
267 Event: &state,
268 Body: &body,
269 },
270 }
271
272 return client.Mutate(repo.RepoHost(), "PullRequestReviewAdd", &mutation, variables)
273}
274
275// AddPullRequestReviews adds the given user and team reviewers to a pull request using the REST API.
276// Team identifiers can be in "org/slug" format.

Callers 1

reviewRunFunction · 0.92

Calls 3

MutateMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected