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

Function SuggestedReviewerActors

api/queries_pr_review.go:410–556  ·  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

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

Callers 2

reviewerSearchFuncFunction · 0.92

Calls 9

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

Tested by 1