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

Function listIssueTemplates

pkg/cmd/pr/shared/templates.go:61–87  ·  view source on GitHub ↗
(httpClient *http.Client, repo ghrepo.Interface)

Source from the content-addressed store, hash-verified

59}
60
61func listIssueTemplates(httpClient *http.Client, repo ghrepo.Interface) ([]Template, error) {
62 var query struct {
63 Repository struct {
64 IssueTemplates []issueTemplate
65 } `graphql:"repository(owner: $owner, name: $name)"`
66 }
67
68 variables := map[string]any{
69 "owner": githubv4.String(repo.RepoOwner()),
70 "name": githubv4.String(repo.RepoName()),
71 }
72
73 gql := api.NewClientFromHTTP(httpClient)
74
75 err := gql.Query(repo.RepoHost(), "IssueTemplates", &query, variables)
76 if err != nil {
77 return nil, err
78 }
79
80 ts := query.Repository.IssueTemplates
81 templates := make([]Template, len(ts))
82 for i := range templates {
83 templates[i] = &ts[i]
84 }
85
86 return templates, nil
87}
88
89func listPullRequestTemplates(httpClient *http.Client, repo ghrepo.Interface) ([]Template, error) {
90 var query struct {

Callers

nothing calls this directly

Calls 6

NewClientFromHTTPFunction · 0.92
StringMethod · 0.65
RepoOwnerMethod · 0.65
RepoNameMethod · 0.65
QueryMethod · 0.65
RepoHostMethod · 0.65

Tested by

no test coverage detected