Skip to content

Look for pull request templates during PR creation#1283

Merged
RMacfarlane merged 2 commits intomasterfrom
rmacfarlane/prtemplates
Jul 26, 2019
Merged

Look for pull request templates during PR creation#1283
RMacfarlane merged 2 commits intomasterfrom
rmacfarlane/prtemplates

Conversation

@RMacfarlane
Copy link
Contributor

@RMacfarlane RMacfarlane commented Jul 25, 2019

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.

@RMacfarlane RMacfarlane requested a review from rebornix July 25, 2019 17:45
Copy link
Member

@rebornix rebornix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The only suggestion is we may want to keep it transparent to users/repositories who don't use templates.

let template: vscode.Uri | undefined;

if (pullRequestTemplates.length === 0) {
progress.report({ increment: 5, message: 'No pull request template found. Creating pull request...' });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if this should be transparent to users who are not aware of Pull Request Templates.

@RMacfarlane RMacfarlane merged commit 2f51a76 into master Jul 26, 2019
@RMacfarlane RMacfarlane deleted the rmacfarlane/prtemplates branch September 6, 2019 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pull request template not working

2 participants