in Web Development

Github PR Template

A common issue with working in a team on a project is dealing with Pull Requests that don't have the required information to understand the reason why for the change.

Pull request reviews are common practice when working in a team of developers, but if people do not provide the right information on the pull request it can be difficult to review and approve these changes.

What do we need to know to review a change request?

  • The reason for change?
  • The ticket number related to the change
  • Automated build checks
  • Testing steps

In your team reviews you can create a rule of when creating a pull request to add this list of information to the pull request description. But there's a better way, in Github you can check a pull request template file that will be used to pre-populate the description of the pull request when a new one is created.

When you add a pull request template to your repository, project contributors will automatically see the template’s contents in the pull request body.

Create a .github folder in the root of your project, inside this folder create a new file called pull_request_template.md, the contents of this markdown is used on your pull requests.

Here is an example I've used on many projects.

# Ticket

Please provide a link to the ticket related to this change

# Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

# How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

- [ ] Test A
- [ ] Test B

# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules

You can adapt the above to meet the needs of your team and your project.