Look for pull request templates during PR creation#1283
Merged
RMacfarlane merged 2 commits intomasterfrom Jul 26, 2019
Merged
Conversation
rebornix
approved these changes
Jul 25, 2019
Member
rebornix
left a comment
There was a problem hiding this comment.
LGTM. The only suggestion is we may want to keep it transparent to users/repositories who don't use templates.
src/view/reviewManager.ts
Outdated
| let template: vscode.Uri | undefined; | ||
|
|
||
| if (pullRequestTemplates.length === 0) { | ||
| progress.report({ increment: 5, message: 'No pull request template found. Creating pull request...' }); |
Member
There was a problem hiding this comment.
I'm wondering if this should be transparent to users who are not aware of Pull Request Templates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #798
During PR creation, look to see if there is a pull request template file. If there's only one, use it for the description. If there are multiple, show a quick pick with the file paths for them. If there are none, then just use the commit information as before.
There's no GitHub API that I can see for fetching the template, so instead I'm doing a file search against the repo. To be completely correct, this should actually be a find against the files as they are in the default branch of the repo, but that would require a large number of network calls since the templates can be located in a variety of places, and with arbitrary names in some cases. Or checking out the default branch, doing the search, and returning to the previous branch. The current approach should be much faster than that and correct a vast majority of the time.