I want to create a template that will appear automatically on each pull request.
This can either be a note or a comment. Ideally it will display guidelines as to reviewing the pull request:
- [ ] Have you done x?
- [ ] Have you done y?
- [ ] Have you done z?
Can anyone suggest a way of doing this?
Pull request templates allow your organizations to have a default text when you create a pull request on GitHub. It is quite useful to make sure to follow a standard process for every pull request and to have a to-do list for the author to check before requesting a review.
A default pull request template that is automatically applied for all new pull requests in the repository, unless overridden by a branch specific pull request template. Branch specific pull request templates that are automatically applied to pull requests targeting a specific branch.
Yes, it is now possible.
Add a file named pull_request_template.md
to the root of your project:
- [ ] Have you done x?
- [ ] Have you done y?
- [ ] Have you done z?
You can also create a template for issues using the same convention. Just name the file issue_template.md
.
Source: https://github.com/blog/2111-issue-and-pull-request-templates
GitHub does not allow you to create a template for pull requests created on it's website.
The solution we use is to create pull requests using the github api via the hub
command. We wrap this in a script called makePR that does something like:
#!/bin/bash
URL=$(hub pull-request -F PR-template.md)
echo "New PR created at $URL"
open $URL
(untested - our actual script does a lot more - I've left out parameters I think you don't need)
The open
command will open the URL in the default browser on MacOS, you may need to adjust this for other platforms. Once it is open, you can edit the title in your web browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With