This content originally appeared on DEV Community and was authored by BekahHW
I collect open source projects like some people collect discord servers. To be accurate, I have 525 repositories. Now, before you yell at me, many of those are from my bootcamp lessons when I was learning to code. But I’ve been known to start and stop projects more than once. What I have learned through that experience is the importance of consistency. If you’re in an organization that has multiple repositories, you might find yourself adding the same files over and over–files like the CODE_OF_CONDUCT.md, Pull Request (PR) and Issue templates, and CONTRIBUTING.md. As developers, adding these files repeatedly starts to feel like we’re violating DRY code principles. Fortunately, the .github repository can help solve this problem.
What is a .github
Repo?
A .github
repository is a special type of repository in GitHub that allows maintainers to store community health files and templates for their projects.
Community Health files promote the well-being of the community and focus on communication, documentation, supporting members through a code of conduct, and community recognition.
The .github
repository–found at https://github.com/<username/organization>/.github
- can house the community health files for your organization as the default files. According to GitHub, “While the file itself won’t appear in the file browser or Git history for each repository, it will be surfaced throughout developers’ workflows, such as when opening a new issue or when viewing the Community Profile, just as if it were committed to the repository directly.”
Using a .github
repository, allows maintainers to efficiently manage the files and templates that are important for their project's workflow and community and ensure consistency throughout the organization's repositories. So what do you add to the .github
repository? One example is a Pull Request Template since they’re often standard across repos.
How to Add a PR Template
Adding a PR template to your .github
repository is straightforward. First, navigate to the repository in question and click on the "Create new file" button. Next, in the file name field, type .github/PULL_REQUEST_TEMPLATE.md
.
In the main text field, you can add the content of your PR template. This can include prompts for information such as the purpose of the PR, the changes made, any potential issues or concerns, and any additional context or resources that may be helpful–check out ours here. You can also use markdown to format the template, making it more readable and easier to understand.
Once you have added your PR template, click the "Commit new file" button to save it to your repository. Now, every time a contributor opens a new PR, they will be prompted to use the template you created.
Considerations for Maintainers
When creating a PR template, keep in mind that the template is easy to read and understand. Remember, the template is supposed to make things easier for you and the contributors. What information do you need to be able to review the PR more efficiently? What information can guide a new contributor through writing a PR for the first time?
Finally, the beauty of using one template for all your repositories is that if you decide to update it, you only need to do that in one location. As your project evolves and new requirements emerge, you may find that the template needs to be revised or you might feedback from contributors and other maintainers, and make changes as needed to ensure that the PR template remains effective and useful. If you're interested in more content on PRs, check out Writing Your First Pull Request: Tips, Best Practices, and AI-Powered Tools for Success and How to Create a Good Pull Request Template (and Why You Should Add Gifs).
This content originally appeared on DEV Community and was authored by BekahHW
BekahHW | Sciencx (2023-04-24T16:47:59+00:00) Managing Community Health Files and Templates with a .github Repository. Retrieved from https://www.scien.cx/2023/04/24/managing-community-health-files-and-templates-with-a-github-repository/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.