Good repositories guide contributors automatically. In this lesson you will set up CODEOWNERS so the right people review every change, create issue templates and forms that produce complete bug reports, and add a pull request template.
📖 What You’ll Learn: the special .github files, CODEOWNERS syntax and precedence, enforcing code owner reviews, Markdown issue templates, YAML issue forms, the template chooser config, pull request templates, and organisation-wide defaults.
🧭 Why These Files?
As a repository grows, three questions come up again and again: Who should review this change? What information does a bug report need? What should every pull request description include? GitHub answers them with special files in the repository, usually in the .github/ folder:
| File | Purpose |
|---|---|
.github/CODEOWNERS | Automatically requests reviews from the owners of changed files |
.github/ISSUE_TEMPLATE/*.md or *.yml | Templates and forms for new issues |
.github/ISSUE_TEMPLATE/config.yml | Controls the “New issue” chooser |
.github/pull_request_template.md | Pre-fills every new pull request description |
👥 CODEOWNERS
A CODEOWNERS file maps file patterns to people or teams. When a pull request changes matching files, GitHub automatically requests their review. Place it in .github/, the repository root or docs/.
# .github/CODEOWNERS
# Each line: <pattern> <owners...>. The LAST matching pattern wins.
# Default owners for everything
* @acme/qa-leads
# Test automation framework
/tests/ @acme/qa-automation
/src/pages/ @acme/qa-automation @asha-verma-qa
# CI and workflow changes need DevOps review
/.github/workflows/ @acme/devops
# Test data owned by one person
/test-data/*.json @ravi-kumar
# Documentation
*.md @acme/docs
| Rule | Detail |
|---|---|
| Owners | @username, @org/team-name or an email address; they need write access |
| Patterns | Mostly like .gitignore patterns |
| Precedence | The last matching line in the file wins, so put general rules first |
| Enforcement | Turn on Require review from Code Owners in branch protection or rulesets to make owner approval mandatory |
💡 Tip: GitHub shows a warning on the CODEOWNERS file page if a line has a syntax error or an owner without access. Check it after every change.
🐞 Issue Templates
Markdown templates
---
name: Bug report
about: Report a defect found in testing
title: "[Bug]: "
labels: bug, needs-triage
assignees: ''
---
### Steps to reproduce
1.
2.
### Expected result
### Actual result
### Environment
- Browser / device:
- Build / commit:
### Evidence
Screenshots, logs or Playwright traces.
Save as .github/ISSUE_TEMPLATE/bug_report.md. The block between --- lines (front matter) sets the name, default title, labels and assignees.
Issue forms (YAML)
Issue forms create a real form with required fields and dropdowns, which leads to more complete bug reports:
# .github/ISSUE_TEMPLATE/bug_report.yml
name: Bug report
description: Report a defect found in testing
title: "[Bug]: "
labels: ["bug", "needs-triage"]
body:
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: "1. Log in as standard_user\n2. Add the backpack to the cart"
validations:
required: true
- type: textarea
id: expected-actual
attributes:
label: Expected vs actual result
validations:
required: true
- type: dropdown
id: environment
attributes:
label: Environment
options:
- QA
- Staging
- Production
validations:
required: true
- type: dropdown
id: severity
attributes:
label: Severity
options: [Critical, Major, Minor, Trivial]
The template chooser
# .github/ISSUE_TEMPLATE/config.yml
blank_issues_enabled: false
contact_links:
- name: Questions and discussion
url: https://github.com/acme/qa-platform/discussions
about: Ask questions here instead of opening an issue.
Issues are explained in GitHub Issues, Labels and Projects.
🔃 Pull Request Template
<!-- .github/pull_request_template.md -->
## What does this PR change?
## Why is it needed?
Closes #
## How was it tested?
- [ ] Unit tests
- [ ] Playwright tests pass locally (npx playwright test)
- [ ] Tested manually on:
## Screenshots (UI changes)
## Checklist
- [ ] No secrets or debug code
- [ ] Docs updated if needed
Every new pull request starts with this text, which nudges authors to give reviewers what they need (pull requests). For several templates, create a .github/PULL_REQUEST_TEMPLATE/ folder; they are chosen with a ?template=name.md query parameter in the PR URL.
🏢 Organisation-Wide Defaults
Create a public repository named .github in your organisation (or account). Templates and community files there (issue templates, pull request template, CONTRIBUTING.md, SECURITY.md) act as defaults for repositories that do not have their own.
📝 Assignment
- Add
.github/CODEOWNERStogit-practicethat makes you the owner of everything and a teammate (or second account) the owner oftests/. - Open a PR that changes a file in
tests/and confirm the review request is automatic. - Add a Markdown bug report template and a YAML issue form; open an issue with each.
- Disable blank issues and add a contact link.
- Add a pull request template and open a new PR to see it pre-filled.
- Bonus: enable “Require review from Code Owners” in your ruleset.
❓ FAQ
🤔 What is a CODEOWNERS file?
A file in .github/, the root or docs/ that maps file patterns to users or teams who are automatically requested to review pull requests touching those files.
🤔 Where do I put the CODEOWNERS file?
In .github/CODEOWNERS, CODEOWNERS in the repository root, or docs/CODEOWNERS. GitHub uses the first one it finds in that order.
🤔 How do I create an issue template on GitHub?
Add Markdown or YAML files to .github/ISSUE_TEMPLATE/, or use Settings, Features, Issues, Set up templates.
🤔 How do I add a pull request template?
Create .github/pull_request_template.md; its content pre-fills every new pull request.
🤔 What is the difference between issue templates and issue forms?
Markdown templates pre-fill the text box. Issue forms (YAML) show structured fields such as dropdowns and required text areas.
🎯 Next Steps
- 🔐 Secrets, Dependabot and Code Scanning
- 🛡️ Branch Protection Rules and Rulesets
- 📘 Git and GitHub Tutorial: full course
🎬 Learn Git and GitHub step by step: watch the series on YouTube!
Subscribe to SqaToolsByDY • Practice on sqatools.in
2 thoughts on “GitHub CODEOWNERS, Issue Templates, Issue Forms and Pull Request Templates”