Conversation
| m.templates = make([]Template, len(issueTemplates)) | ||
| for i := range issueTemplates { | ||
| m.templates[i] = &issueTemplates[i] | ||
| } |
There was a problem hiding this comment.
I moved this work into the list functions so that they would both have the same function signatures.
mislav
left a comment
There was a problem hiding this comment.
Thanks for taking this on!
pkg/cmd/pr/shared/templates.go
Outdated
| return hasQuerySupport && hasMutationSupport, nil | ||
| } | ||
|
|
||
| func hasPullRequestTemplateSupport(httpClient *http.Client, hostname string) (bool, error) { |
There was a problem hiding this comment.
This function does the exact same query as hasIssueTemplateSupport, except that it scans for a different field on a Repository object. Could this lookup instead piggyback on hasIssueTemplateSupport so that fewer API calls are done?
There was a problem hiding this comment.
Yup good call. I consolidated hasIssueTemplateSupport and hasPullRequestTemplateSupport into a single hasTemplateSupport function which uses one query and supports both issues and pull requests.
mislav
left a comment
There was a problem hiding this comment.
Looks great! One minor note about keeping the GraphQL query unchanged (for cache key purposes)
|
Thank you, @samcoe! |
This PR adds the ability to use non-local templates when opening a PR. It is mostly a copy of the work done for issue create templates.
Closes #838