MCPcopy Index your code
hub / github.com/cli/cli / RequestReviewsByLogin

Function RequestReviewsByLogin

api/queries_pr_review.go:347–388  ·  view source on GitHub ↗

RequestReviewsByLogin sets requested reviewers on a pull request using the GraphQL mutation. This mutation replaces existing reviewers with the provided set unless union is true. Only available on github.com, not GHES. Bot logins should be passed without the [bot] suffix; it is appended automaticall

(client *Client, repo ghrepo.Interface, prID string, userLogins, botLogins, teamSlugs []string, union bool)

Source from the content-addressed store, hash-verified

345// Team slugs must be in the format "org/team-slug".
346// When union is false (replace mode), passing empty slices will remove all reviewers.
347func RequestReviewsByLogin(client *Client, repo ghrepo.Interface, prID string, userLogins, botLogins, teamSlugs []string, union bool) error {
348 // In union mode (additive), nothing to do if all lists are empty.
349 // In replace mode, we may still need to call the mutation to clear reviewers.
350 if union && len(userLogins) == 0 && len(botLogins) == 0 && len(teamSlugs) == 0 {
351 return nil
352 }
353
354 var mutation struct {
355 RequestReviewsByLogin struct {
356 ClientMutationId string `graphql:"clientMutationId"`
357 } `graphql:"requestReviewsByLogin(input: $input)"`
358 }
359
360 type RequestReviewsByLoginInput struct {
361 PullRequestID githubv4.ID `json:"pullRequestId"`
362 UserLogins *[]githubv4.String `json:"userLogins,omitempty"`
363 BotLogins *[]githubv4.String `json:"botLogins,omitempty"`
364 TeamSlugs *[]githubv4.String `json:"teamSlugs,omitempty"`
365 Union githubv4.Boolean `json:"union"`
366 }
367
368 input := RequestReviewsByLoginInput{
369 PullRequestID: githubv4.ID(prID),
370 Union: githubv4.Boolean(union),
371 }
372
373 userLoginValues := toGitHubV4Strings(userLogins, "")
374 input.UserLogins = &userLoginValues
375
376 // Bot logins require the [bot] suffix for the mutation
377 botLoginValues := toGitHubV4Strings(botLogins, "[bot]")
378 input.BotLogins = &botLoginValues
379
380 teamSlugValues := toGitHubV4Strings(teamSlugs, "")
381 input.TeamSlugs = &teamSlugValues
382
383 variables := map[string]interface{}{
384 "input": input,
385 }
386
387 return client.Mutate(repo.RepoHost(), "RequestReviewsByLogin", &mutation, variables)
388}
389
390// SuggestedReviewerActors fetches suggested reviewers for a pull request.
391// It combines results from three sources using a cascading quota system:

Callers 2

CreatePullRequestFunction · 0.85

Calls 4

toGitHubV4StringsFunction · 0.85
IDMethod · 0.65
MutateMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected