Table of Contents generated with DocToc
This project solves a simple problem:
- GitHub allows you to specify a set of organization-wide PR templates by
creating a public
.github
repository under your organization to contain them. (docs). These can be used to initialize pull request descriptions with useful starting points. - If you create a single
.github/pull_request_template.md
file, that will be used as the default template for all PRs in repositories in your organization that don't have their own pull request template set. Great! - But... if you instead create multiple PR templates in a
.github/PULL_REQUEST_TEMPLATE
directory in your org's public.github
repository, the only way to select among them is using a query parameter in the URL. - This is annoying and error prone!
So, this project provides userscripts (and maybe browser extensions) to make this easier.
Navigate to the following URL to install the userscript in Tampermonkey or Greasemonkey:
https://raw.githubusercontent.com/bclarkx2/github-pr-template-picker/main/src/script.tamper.js
Navigate to a "compare" page on the GitHub web app (e.g. https://github.com/bclarkx2/github-pr-template-picker/compare/some/feature).
Set the Source field to the API URL for your organization's Pull Request templates and click the "Save" button. The format is:
https://api.github.com/repos/:org/.github/contents/.github/PULL_REQUEST_TEMPLATE
Where:
:org
- the name of your GitHub organization.
This will also work with any public directory on GitHub containing a list of markdown files.
Then, just use the "PR Template" dropdown to select the PR template you'd like to use!