Skip to content

Commit 95d656b

Browse files
author
Randy Pagels
committed
Add section on required reviewers in pull requests to enhance repository security
1 parent 3d3ebe7 commit 95d656b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

learn-pr/github/maintain-secure-repository-github/includes/2-how-to-maintain-secure-repository.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,26 @@ You can use the workflows that protect the branch to:
117117
- Run automated tests to check for any behavior changes of the code;
118118
- And so on.
119119

120+
## Required reviewers in pull requests
121+
122+
You can improve repository security by requiring reviews before code is merged into important branches. Required reviewers help enforce quality, security, and accountability.
123+
124+
To configure required reviewers:
125+
126+
1. Navigate to the repository on GitHub.
127+
2. Under the repository name, click **Settings** > **Branches**.
128+
3. Next to the branch you want to protect, click **Add rule** or edit an existing rule.
129+
4. Select **Require pull request reviews before merging**.
130+
5. Optionally, check:
131+
- **Require review from Code Owners**
132+
- **Dismiss stale pull request approvals when new commits are pushed**
133+
- **Require approval from someone other than the last pusher**
134+
135+
Required reviews can’t be bypassed without admin permissions. They ensure that proposed changes are reviewed by another contributor or designated code owner before being merged.
136+
137+
For more details, see [About protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches).
138+
139+
120140
## Add a CODEOWNERS file
121141

122142
By adding a [CODEOWNERS](https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax) file to your repository, you can assign individual team members or entire teams as code owners to paths in your repository. These code owners are then required for pull-request reviews on any changes to files in a path for which they're configured.

0 commit comments

Comments
 (0)