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

Function preloadPrClosingIssuesReferences

pkg/cmd/pr/shared/finder.go:522–559  ·  view source on GitHub ↗
(client *http.Client, repo ghrepo.Interface, pr *api.PullRequest)

Source from the content-addressed store, hash-verified

520}
521
522func preloadPrClosingIssuesReferences(client *http.Client, repo ghrepo.Interface, pr *api.PullRequest) error {
523 if !pr.ClosingIssuesReferences.PageInfo.HasNextPage {
524 return nil
525 }
526
527 type response struct {
528 Node struct {
529 PullRequest struct {
530 ClosingIssuesReferences api.ClosingIssuesReferences `graphql:"closingIssuesReferences(first: 100, after: $endCursor)"`
531 } `graphql:"...on PullRequest"`
532 } `graphql:"node(id: $id)"`
533 }
534
535 variables := map[string]any{
536 "id": githubv4.ID(pr.ID),
537 "endCursor": githubv4.String(pr.ClosingIssuesReferences.PageInfo.EndCursor),
538 }
539
540 gql := api.NewClientFromHTTP(client)
541
542 for {
543 var query response
544 err := gql.Query(repo.RepoHost(), "closingIssuesReferences", &query, variables)
545 if err != nil {
546 return err
547 }
548
549 pr.ClosingIssuesReferences.Nodes = append(pr.ClosingIssuesReferences.Nodes, query.Node.PullRequest.ClosingIssuesReferences.Nodes...)
550
551 if !query.Node.PullRequest.ClosingIssuesReferences.PageInfo.HasNextPage {
552 break
553 }
554 variables["endCursor"] = githubv4.String(query.Node.PullRequest.ClosingIssuesReferences.PageInfo.EndCursor)
555 }
556
557 pr.ClosingIssuesReferences.PageInfo.HasNextPage = false
558 return nil
559}
560
561func preloadPrChecks(client *http.Client, repo ghrepo.Interface, pr *api.PullRequest) error {
562 if len(pr.StatusCheckRollup.Nodes) == 0 {

Callers 1

FindMethod · 0.85

Calls 5

NewClientFromHTTPFunction · 0.92
IDMethod · 0.65
StringMethod · 0.65
QueryMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected