Loading docks

Sharing Github Issue & Pull Request Templates

Photo by Hannes Egler on Unsplash

Pull request and issue templates in Github have proven to be extremely valuable to our workflows. We continue to refine them to remind us of our ever evolving best practices and continually improve our issue and pull request processes. A recent idea for an improvement to our pull request template left me faced with daunting the task of updating the template in all of our repositories.

After some searching, I found a comment with a link to a help page that explained how to create a default community conduct file.

You can add default community health files to the root of a public repository called .github that is owned by an organization or user account. GitHub will use and display default files for any public repository owned by the account that does not have its own file of that type in any of the following places: The approach seemed too good to be true and didn’t mention issue or pull request templates specifically. I still gave it a shot, and it ended up working!

The approach is as follows:

Create a public repository named .github within your organization. Create a .github folder within that repository with issue templates, PR templates, etc, just as you would for templates in a normal repository. Delete the files you want to inherit from all other code repositories and verify the results.

That’s it! It is that simple. Now you can share templates across your organization and update Github templates in one place.

There are a couple caveats: If you override a single issue template, you will not inherit any other issue templates. There is no “merging” of issue templates. You are able to override issue templates, and still inherit pull request templates.

You can checkout our templates in our .github repository.

This isn’t groundbreaking, but it is a simple win that is already making a big impact. We are now able to easily update a single template and see the benefits on all of our projects. Hopefully this sheds a light on some hidden functionality that doesn’t appear to be well documented, but has the potential to greatly improve your Github workflows.

Related Posts & Presentations