DEV Community

loading...

How to set up GitHub/GitLab issue and PR templates

giulia_chiola profile image Giulia Chiola Originally published at giuliachiola.dev ・2 min read

Templates for both GitLab and GitHub

Use the content that works best for you, here there are mine.

Template Snippet
issue 🦊 GitLab snippet
pull request / merge request 🦊 GitLab snippet
release 🦊 GitLab snippet

Basic

GitHub

  • Create .github folder in project root.
  • Add templates files following this folder structure
β”œβ”€β”€ .gitlab/
β”‚Β Β  β”œβ”€β”€ ISSUE_TEMPLATE/
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ issue-templates.md
β”‚Β Β  β”œβ”€β”€ PULL_REQUEST_TEMPLATE/
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ merge-request-templates.md
β”‚Β Β  β”œβ”€β”€ RELEASE_TEMPLATE/
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ release-templates.md
Enter fullscreen mode Exit fullscreen mode
  • Commit and push on our default branch.

  • Check our project on GitHub. From now on, when we will open an issue, it will be pre-compiled with the markdown template we added.

issue template 01

issue template 02

GitLab

In GitLab is pretty much the same, but here we have to create a folder named .gitlab, and add this folders structure:

β”œβ”€β”€ .gitlab/
β”‚Β Β  β”œβ”€β”€ issue_templates/
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ issue-templates.md
β”‚Β Β  β”œβ”€β”€ merge_request_templates/
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ merge-request-templates.md
β”‚Β Β  β”œβ”€β”€ release_templates/
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ release-templates.md
Enter fullscreen mode Exit fullscreen mode

Advanced

If we need different templates to choose, we have to add folders instead of files, and add many files as we need.

β”œβ”€β”€ .github
β”‚Β Β  β”œβ”€β”€ ISSUE_TEMPLATE
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ bug-report.md
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ feature.md
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ nice-to-have.md
β”‚Β Β  β”œβ”€β”€ PULL_REQUEST_TEMPLATE.md
β”‚Β Β  β”œβ”€β”€ RELEASE_TEMPLATE
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ default.md
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ hotfix.md
Enter fullscreen mode Exit fullscreen mode

πŸ“š More info

Discussion (0)

pic
Editor guide