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

Function SuggestedReviewerActors

api/queries_pr_review.go:399–545  ·  view source on GitHub ↗

SuggestedReviewerActors fetches suggested reviewers for a pull request. It combines results from three sources using a cascading quota system: - suggestedReviewerActors - suggested based on PR activity (base quota: 5) - repository collaborators - all collaborators (base quota: 5 + unfilled from sugg

(client *Client, repo ghrepo.Interface, prID string, query string)

Source from the content-addressed store, hash-verified

397// unfilled quota from the previous source. Results are deduplicated.
398// Returns the candidates, a MoreResults count, and an error.
399func SuggestedReviewerActors(client *Client, repo ghrepo.Interface, prID string, query string) ([]ReviewerCandidate, int, error) {
400 // Fetch 10 from each source to allow cascading quota to fill from available results.
401 // Organization teams are fetched via repository.owner inline fragment, which
402 // gracefully returns empty data for personal (User-owned) repos.
403 // We also fetch unfiltered total counts via aliases for the "X more" display.
404 type responseData struct {
405 Node struct {
406 PullRequest struct {
407 Author struct {
408 Login string
409 }
410 SuggestedActors struct {
411 Nodes []struct {
412 IsAuthor bool
413 IsCommenter bool
414 Reviewer struct {
415 TypeName string `graphql:"__typename"`
416 User struct {
417 Login string
418 Name string
419 } `graphql:"... on User"`
420 Bot struct {
421 Login string
422 } `graphql:"... on Bot"`
423 }
424 }
425 } `graphql:"suggestedReviewerActors(first: 10, query: $query)"`
426 } `graphql:"... on PullRequest"`
427 } `graphql:"node(id: $id)"`
428 Repository struct {
429 Owner struct {
430 TypeName string `graphql:"__typename"`
431 Organization struct {
432 Teams struct {
433 Nodes []struct {
434 Slug string
435 }
436 } `graphql:"teams(first: 10, query: $query)"`
437 TeamsTotalCount struct {
438 TotalCount int
439 } `graphql:"teamsTotalCount: teams(first: 0)"`
440 } `graphql:"... on Organization"`
441 }
442 Collaborators struct {
443 Nodes []struct {
444 Login string
445 Name string
446 }
447 } `graphql:"collaborators(first: 10, query: $query)"`
448 CollaboratorsTotalCount struct {
449 TotalCount int
450 } `graphql:"collaboratorsTotalCount: collaborators(first: 0)"`
451 } `graphql:"repository(owner: $owner, name: $name)"`
452 }
453
454 variables := map[string]interface{}{
455 "id": githubv4.ID(prID),
456 "query": githubv4.String(query),

Callers 2

reviewerSearchFuncFunction · 0.92

Calls 9

NewReviewerUserFunction · 0.85
NewReviewerBotFunction · 0.85
NewReviewerTeamFunction · 0.85
IDMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
QueryMethod · 0.65
RepoHostMethod · 0.65
StringMethod · 0.45

Tested by 1