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

Function preloadPrClosingIssuesReferences

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

Source from the content-addressed store, hash-verified

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