Multiple Pull Request Template

Hi Team,

I would like to create multiple PR templates for the same repo, so I ended up creating following template files inside repo per https://help.github.com/articles/creating-a-pull-request-template-for-your-repository/

.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE1.md

.github/PULL_REQUEST_TEMPLATE/PR_TEMPLATE2.md

However, while passing the query parameter, contents of the template does NOT seem to be auto populated in the PR. My query parameter is like below

https://github.com/OrgName/repo/compare/branch1…master?expand=1&template=PULL_REQUEST_TEMPLATE/PR_TEMPLATE2.md

Does it accept custom template names? How does the multiple PR template work in such scenarios? Thanks !

1 Like

Hi @thunderbirdgit,

Your query parameter should be formatted as https://github.com/OrgName/repo/compare/branch1...master?expand=1&template=PR_TEMPLATE2.md, I believe. It will look for this file in the PULL_REQUEST_TEMPLATE/ subdirectory.

Could you tell me more about what you mean by custom template names? You can use custom file names to name your templates.

Thanks!

Thanks @that-pat, unfortunately, that did not work either… I dont see the template contents auto populating

https://github.com/Orgname/repo/compare/branch1…master?expand=1&template=PR_TEMPLATE1.md

I actually meant custom filenames to the templates. This is how the structure looks like

.github/PULL_REQUEST_TEMPLATE/

PR_TEMPLATE1.md

.github/PULL_REQUEST_TEMPLATE/

It works if a singlePULL_REQUEST_TEMPLATE file is placed in the following directories, but doesnt work for multiple template files

.github/PULL_REQUEST_TEMPLATE.md

or

.github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md

or

<repo_basedirectory>/PULL_REQUEST_TEMPLATE.md

Hi @thunderbirdgit,

Is your repository public? If so, could you share a link to it? I’d love to see what your file setup looks like directly.

Thanks!

Unfortunately, not. Let me checkin the same file to my public repo and share the link. Thanks @that-pat

I just tried it on my public repo and it works great as expected

We are on version 2.11.2 on my private official repo and I see PR tempate is supported since 2.10.

Do you know if anything could be missing on our private github?

Looks like support for multiple PR template might be supported only from 2.12 version of Enterprise Github. We will look for the option to upgrade -  https://help.github.com/enterprise/2.12/user/articles/creating-a-pull-request-template-for-your-repository/

1 Like

Hi @thunderbirdgit,

For some reason, I didn’t realize that you were working on GitHub Enterprise. Yes, that feature was added in GitHub Enterprise verson 2.12, you are correct. GitHub Enterprise always lags behind GitHub.com a slight bit as features are added into each feature release after they have been added to GitHub.com.

Thanks!

Sorry if this is the wrong place, definitely open to hearing a better one. :slight_smile:

I have 2 PR templates.

  • PULL_REQUEST_TEMPLATE.md
  • release.md

I placed both in: /.github/PULL_REQUEST_TEMPLATE - per these instructions

I’m not a fan of having to modify the query string of the URL.

When I submit a PR from GitHub Desktop, I would like the PULL_REQUEST_TEMPLATE.md to be used by default. I have instructions there on how to use the other templates.

With that said, given that GitHub Desktop goes to GitHub’s website, I’m not sure I understand why a dropdown mechanism (similar to draft PRs) cannot be employed. Maybe to the left of the submission button (but not green). Default would be PULL_REQUEST_TEMPLATE.md with the release.md in the dropdown. (If there was only one template in the folder or project, no need for the dropdown.)

Thoughts?

Cheers.

Hi,

I had the same issue, you just have to follow this structure

.github
    -> PULL_REQUEST_TEMPLATE.md (This going to be the default one)
    -> PULL_REQUEST_TEMPLATE (folder)
        -> custom1 
        -> custom2
1 Like

Thanks for that! Now if only we didn’t have to put it in the URL. lol