Search code examples
githubpull-request

Multiple templates for Pull Requests on Github


According to documentation I had to create a PULL_REQUEST_TEMPLATE folder in .github folder.

Then add my pull_request_first_template and pull_request_second_template.md into PULL_REQUEST_TEMPLATE folder.

When I try to open a new PR, no templates are being displayed, not speaking of even switching between them.

Seems like templates are not displaying at all. Is there a solution to that?


Solution

  • Short answer, yes there is a solution to this. However, there are a few steps to make this possible:

    1. Create either a .github/ or docs/ directory in your root directory.
    2. Create a directory inside called PULL_REQUEST_TEMPLATE.
    3. Create as many templates as you'd like within this directory, let's say template_one.md and template_two.md.
    4. Begin making a pull request and append the URL with: "&template=template_one.md"

    My example URL looks like: https://github.com/<org>/<repo-name>/compare/main...test-branch?template=template_one.md

    enter image description here