PullApprove Configuration
PullApprove is a powerful code review automation tool that uses a CODEREVIEW.toml file to define review requirements and workflows. This documentation covers all available configuration options and how to use them effectively.
Quick Start
A basic CODEREVIEW.toml file contains one or more review scopes:
[[scopes]]
name = "app"
paths = ["app/**/*"]
reviewers = ["dev1", "dev2"]
require = 1
Configuration Structure
Root Configuration
These settings apply to the entire configuration file:
aliases- Define reusable reviewer groups with$prefix syntaxbranches- Control which branches PullApprove runs onextends- Inherit configuration from other CODEREVIEW.toml fileslarge_scale_change- Handle pull requests with very large changestemplate- Mark a configuration as a template for reuse
Review Scopes
The core of PullApprove configuration is the [[scopes]] array. Each scope defines review requirements for specific files or conditions.
Basic Scope Properties
name- Unique identifier for the scope (required)description- Human-readable description of the scope's purposepaths- Glob patterns to match files (required)
Reviewer Configuration
reviewers- List of eligible reviewers for this scopealternates- Additional reviewers who can approve but won't be auto-requestedrequire- Number of approvals required (default: 0)request- Number of reviewers to auto-request
Advanced Matching
authors- Match scopes to specific PR authorsbranches- Match scopes to specific target/source branchescode- Match scopes based on code changes within fileslabels- Automatically apply labels when scope matches
Ownership Models
ownership- Control how scopes interact (append,global)author_value- Count PR author as an approverreviewed_for- Require explicit scope acknowledgment in reviews
Communication
instructions- Send custom instructions to reviewers
Configuration Examples
Basic Setup
[[scopes]]
name = "general"
paths = ["**/*"]
reviewers = ["dev1", "dev2", "dev3"]
require = 1
request = 1
Using Aliases
[aliases]
backend_team = ["alice", "bob", "charlie"]
frontend_team = ["dave", "eve", "frank"]
[[scopes]]
name = "backend"
paths = ["api/**/*", "**/*.py"]
reviewers = ["$backend_team"]
require = 2
[[scopes]]
name = "frontend"
paths = ["web/**/*", "**/*.js", "**/*.css"]
reviewers = ["$frontend_team"]
require = 1
Multi-Level Ownership
# Global admins can approve anything
[[scopes]]
name = "admins"
ownership = "global"
paths = ["**/*"]
reviewers = ["admin1", "admin2"]
# Security changes always need security team
[[scopes]]
name = "security"
ownership = "append"
paths = ["**/security/**/*"]
reviewers = ["security-expert"]
require = 1
# Regular app changes
[[scopes]]
name = "app"
paths = ["app/**/*"]
reviewers = ["dev1", "dev2"]
require = 1
Code Pattern Matching
[[scopes]]
name = "security-sensitive"
paths = ["**/*.py"]
code = [
"^(\+|-).*@csrf_exempt.*",
"^(\+|-).*subprocess\.",
"^(\+|-).*eval\("
]
reviewers = ["security-team"]
require = 2
instructions = """
This change contains security-sensitive code patterns.
Please review carefully for potential vulnerabilities.
"""
How Scopes Work
- Order Matters: Scopes are evaluated in the order they're defined
- Last Match Wins: By default, the last matching scope determines who reviews a file
- Ownership Modifiers: Use
appendorglobalownership to change this behavior - Multiple Files: Each changed file is matched independently to scopes
- Draft PRs: Draft pull requests are automatically skipped and not processed by PullApprove
Best Practices
- Start Simple: Begin with basic path-based scopes and add complexity as needed
- Use Descriptive Names: Scope names appear in the UI, make them clear
- Leverage Aliases: Reduce duplication and make updates easier
- Test Your Config: Use the CLI to validate and test your configuration
- Document Complex Logic: Use
descriptionandinstructionsfor clarity
Advanced Features
Multiple Configuration Files
You can have multiple CODEREVIEW.toml files in different directories. The closest one to each changed file will be used:
# app/CODEREVIEW.toml
extends = ["../CODEREVIEW.toml"]
[[scopes]]
name = "app-specific"
paths = ["**/*"]
reviewers = ["app-team"]
Branch-Specific Configuration
Control when PullApprove runs using branch patterns:
branches = [
"main",
"release/*",
"feature/*..develop"
]
Wildcard Reviewers
Accept reviews from anyone with "*":
[[scopes]]
name = "open-review"
reviewers = ["*"]
require = 2
paths = ["docs/**/*"]
Related Documentation
- Scopes Overview - Detailed information about review scopes
- CLI Commands - Use the included CLI to validate and test configurations
- Templates - Share configuration across repositories using the admin UI
This configuration system provides the flexibility to implement sophisticated code review workflows while maintaining clarity and auditability. Start with simple configurations and gradually add complexity as your team's needs evolve.