# Code Approvers

Code Approvers are a list of [GitHub usernames or teams](https://docs.github.com/en/organizations/organizing-members-into-teams/about-teams) that can review and accept pull request changes to a directory or file.

You can enable Code Approvers for a directory by adding a `.vercel.approvers` file to that directory in your codebase. For example, this `.vercel.approvers` file defines the GitHub team `vercel/ui-team` as an approver for the `packages/design` directory:

```sh copy filename="packages/design/.vercel.approvers"
@vercel/ui-team
```

When a team is declared as an approver, all members of that team will be able to approve changes to the directory or file and at least one member of the team must approve the changes.

## Enforcing Code Approvals

Code Approvals by the correct owners are enforced through the `Vercel – Code Owners` GitHub check added by the Vercel GitHub App.

When a pull request is opened, the GitHub App will check if the pull request contains changes to a directory or file that has Code Approvers defined.

If no Code Approvers are defined for the changes then the check will pass. Otherwise, the check will fail until the correct Code Approvers have approved the changes.

To make Code Owners required, follow the [GitHub required status checks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks) documentation to add `Vercel – Code Owners` as a required check to your repository.

## Inheritance

Code Approvers are inherited from parent directories. If a directory does not have a `.vercel.approvers` file, then the approvers from the parent directory will be used.
Furthermore, even if a directory does have a `.vercel.approvers` file, then the approvers from a parent directory with a `.vercel.approvers` file can also approve the changed files.
This structure allows the most specific approver to review most of the code, but allows other approvers who have broader context and approval power to still review and approve the code when appropriate.

To illustrate the inheritance, the following example has two `.vercel.approvers` files.

The first file defines owners for the `packages/design` directory. The `@vercel/ui-team` can approve any change to a file under `packages/design/...`:

```sh copy filename="packages/design/.vercel.approvers"
@vercel/ui-team
```

A second `.vercel.approvers` file is declared at the root of the codebase and allows users `elmo` and `oscar` to approve changes to any part of the repository, including the `packages/design` directory.

```sh copy filename=".vercel.approvers"
@elmo
@oscar
```

The hierarchical nature of Code Owners enables many configurations in larger codebases, such as allowing individuals to approve cross-cutting changes or creating an escalation path when an approver is unavailable.

## Reviewer Selection

When a pull request is opened, the Vercel GitHub App will select the approvers for the changed files.
`.vercel.approvers` files allow extensive definitions of file mappings to possible approvers. In many cases, there will be multiple approvers for the same changed file.
The Vercel GitHub app selects the best reviewers for the pull request based on affinity of `.vercel.approvers` definitions and overall coverage of the changed files.

### Bypassing Reviewer Selection

You can skip automatic assignment of reviewers by adding `vercel:skip:owners` to your pull request description.

To request specific reviewers, you can override the automatic selection by including special text in your pull request description:

```text copy
[vercel:approver:@owner1]
[vercel:approver:@owner2]
```

Code Owners will still ensure that the appropriate code owners have approved the pull request before it can pass. Therefore, make sure to select reviewers who provide sufficient coverage for all files in the pull request.

## Modifiers

Modifiers enhance the behavior of Code Owners by giving more control over the behavior of approvals and reviewer selection. The available modifiers are:

- [silent](#silent)
- [notify](#notify)
- [optional](#optional)
- [team](#team)
- [members](#members-default)
  - [not](#excluding-team-members-from-review)
- [required](#required)

Modifiers are appended to the end of a line to modify the behavior of the owner listed for that line:

```sh copy filename=".vercel.approvers"