in internal/github/client.go [49:83]
func (s *graphqlService) FindIssues(ctx context.Context, owner, repo string, prID, issuesLen int) ([]string, error) {
variables := map[string]interface{}{
"issuesLen": githubv4.Int(issuesLen),
"prID": githubv4.Int(prID),
"owner": githubv4.String(owner),
"repo": githubv4.String(repo),
}
var q struct {
Repository struct {
PullRequest struct {
ClosingIssuesReferences struct {
Edges []struct {
Node struct {
Number int64
}
}
} `graphql:"closingIssuesReferences (first: $issuesLen)"`
} `graphql:"pullRequest(number: $prID)"`
} `graphql:"repository(owner: $owner, name: $repo)"`
}
err := s.client.Query(ctx, &q, variables)
if err != nil {
return nil, fmt.Errorf("graphql mutate: %w", err)
}
issues := make([]string, len(q.Repository.PullRequest.ClosingIssuesReferences.Edges))
for i, e := range q.Repository.PullRequest.ClosingIssuesReferences.Edges {
issues[i] = strconv.FormatInt(int64(e.Node.Number), 10)
}
return issues, nil
}