Project113

Example: Auto Review Assignment

Use reviewer policies to automatically assign the right reviewers when change requests are created, based on the files changed and branch patterns.

Goal

  • Changes to src/frontend/% should be reviewed by the frontend team.
  • Changes to src/backend/% should be reviewed by the backend team.
  • Changes to docs/% should be reviewed by the tech writing team.
  • Every change request requires at least 2 approvals.

Step 1: Create Reviewer Policies

Create a reviewer policy for the frontend team:

  • Name: "Frontend reviewers"
  • Merging ref patterns: feature/%, bugfix/%
  • File patterns: src/frontend/%
  • Reviewers: Members of the frontend-team group.
  • Required: Yes

Create similar policies for backend and docs teams with their respective file patterns and group members.

Step 2: Set Repository Defaults

Instead of a CR policy, configure the requirements as repository defaults. These apply to every change request, on every branch:

  • Minimum approvals: 2
  • Require CI to pass: Yes
  • Require all threads resolved: Yes

Repository defaults cover the common merge requirements, so no fallback CR policy is needed. If a specific branch needs stricter rules, add a targeted CR policy for that branch only.

Result

When a developer opens a change request that modifies files in src/frontend/ and src/backend/:

  • Frontend team members are auto-assigned as reviewers.
  • Backend team members are auto-assigned as reviewers.
  • At least 2 approvals are required before merging.
  • CI must pass and all threads must be resolved before merging.