CODEOWNERS Validation
A high-performance CODEOWNERS validator optimized for large repositories and monorepos. Written in Rust for maximum performance and minimal memory usage.
Features
✅ Active Checks
- File/Directory Existence: Validates that all paths in CODEOWNERS exist in the repository
- Duplicate Pattern Detection: Identifies duplicate ownership patterns
🚧 Planned Features
- Validate file ownership coverage (detect unowned files)
- Verify GitHub owners exist and have repository access
- Comprehensive syntax validation
- Custom check configurations
Performance
Optimized for large CODEOWNERS files:
- Handles 10,000+ rules efficiently
- Minimal memory footprint
- Parallel file system traversal
- Early exit optimization for better performance
Installation
As a GitHub Action
Add to your workflow (.github/workflows/codeowners-validation.yml
):
name: CODEOWNERS Validation
on:
push:
branches:
pull_request:
branches:
jobs:
validate-codeowners:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run CODEOWNERS Validation
uses: ryan-flan/codeowners-validation@latest # Use latest version
with:
checks: |
exists
duplicate_patterns
As a CLI Tool (Coming Soon)
# Install via cargo
# Run validation
Configuration
Action Inputs
Input | Description | Default | Required |
---|---|---|---|
checks |
Comma-separated list of checks to run | all |
No |
path |
Path to CODEOWNERS file | .github/CODEOWNERS |
No |
Available Checks
exists
- Validate all referenced files/directories existduplicate_patterns
- Find duplicate ownership patternsall
- Run all available checks (default)
Action Outputs
Output | Description |
---|---|
result |
Validation result: success or failure |
errors |
Detailed error messages (if any) |
Usage Examples
Basic Validation
- uses: ryan-flan/codeowners-validation@v0.4.4
Specific Checks Only
- uses: ryan-flan/codeowners-validation@v0.4.4
with:
checks: exists
Custom CODEOWNERS Location
- uses: ryan-flan/codeowners-validation@v0.4.4
with:
path: docs/CODEOWNERS
checks: exists,duplicate_patterns
Development
Prerequisites
- Rust 1.70+
- Cargo
Building
# Clone the repository
# Build release version
# Run tests
# Run benchmarks
Performance Testing
The project includes comprehensive benchmarks for large CODEOWNERS files:
# Run all benchmarks
# Run specific benchmark
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Areas for Contribution
- Additional validation checks
- Performance optimizations
- Better error messages
- Documentation improvements
- Test coverage
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Inspired by the need for fast CODEOWNERS validation in large monorepos
- Built with Rust for performance
- Uses globset for efficient pattern matching