Create GitHub Pull Request and Issue Templates

By  on  

There's nothing more frustrating than getting an incomplete bug report.  I've often seen bug reports containing a useless "{x} feature doesn't work"; no steps to reproduce, no URL, no browser or device information, just a hopelessly vague message.  Similar is receiving a pull request or patch which doesn't state its intent and doesn't provide steps to test (and what about unit tests?).  Now that many projects are public, most on GitHub, I've seen a massive rise in these types of sparsely documented issues and pull requests.

I recently found out you an create pull request and issues templates so that when the user goes to file a pull request or issue, your template displays within the description textarea.  Let's have a look at how we can do that!

Creating Template Files

Creating and putting in place the template files is easy:

  • The proper place to put the template files is in a .github directory at the root of your repository
  • The templates are to be created in markdown format
  • The issues template text goes in a ISSUE_TEMPLATE.md file
  • The pull requests template text goes in a PULL_REQUEST_TEMPLATE.md file

A great example of template usage can be seen in the A-Frame repository.  The issue template looks as follows:

**Description:**

- A-Frame Version:
- Platform / Device:
- Reproducible Code Snippet or URL:

<!-- If you have a support question, please ask at https://stackoverflow.com/questions/ask/?tags=aframe rather than filing an issue. -->

If your community repositories suffer from lack of information in issues and pull requests, or you simply want to prevent the problem, create GitHub templates for developers.  They may not provide the information you'd like, but you can at least nudge them in the proper direction!

Recent Features

  • By
    5 HTML5 APIs You Didn&#8217;t Know Existed

    When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It."  Can you blame us though?  We watched the fundamental APIs stagnate for so long that a basic feature...

  • By
    CSS 3D Folding Animation

    Google Plus provides loads of inspiration for front-end developers, especially when it comes to the CSS and JavaScript wonders they create. Last year I duplicated their incredible PhotoStack effect with both MooTools and pure CSS; this time I'm going to duplicate...

Incredible Demos

  • By
    Multiple Backgrounds with CSS

    Anyone that's been in the web development industry for 5+ years knows that there are certain features that we should have had several years ago. One of those features is the HTML5 placeholder; we used JavaScript shims for a decade before placeholder came...

  • By
    HTML5 Datalist

    One of the most used JavaScript widgets over the past decade has been the text box autocomplete widget.  Every JavaScript framework has their own autocomplete widget and many of them have become quite advanced.  Much like the placeholder attribute's introduction to markup, a frequently used...

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!