MCPcopy Create free account
hub / github.com/cli/cli / AddReview

Function AddReview

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

Source from the content-addressed store, hash-verified

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

Callers 1

reviewRunFunction · 0.92

Calls 3

StringMethod · 0.65
MutateMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected