https://github.com/moltinginstar/anabolic-codeowners
CODEOWNERS on steroids: A GitHub Action built for monorepos.
https://github.com/moltinginstar/anabolic-codeowners
ci code-review codeowners github-actions
Last synced: 12 months ago
JSON representation
CODEOWNERS on steroids: A GitHub Action built for monorepos.
- Host: GitHub
- URL: https://github.com/moltinginstar/anabolic-codeowners
- Owner: moltinginstar
- License: mit
- Created: 2024-03-30T11:43:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-02-10T03:40:49.000Z (about 1 year ago)
- Last Synced: 2025-02-14T12:53:35.827Z (about 1 year ago)
- Topics: ci, code-review, codeowners, github-actions
- Language: TypeScript
- Homepage:
- Size: 1.51 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
Anabolic Codeowners
CODEOWNERS on steroids. Built for monorepos.
[](https://opensource.org/licenses/MIT)
[](CODE_OF_CONDUCT.md)

[](https://github.com/moltinginstar/anabolic-codeowners/actions/workflows/check-dist.yaml)
[](https://github.com/moltinginstar/anabolic-codeowners/actions/workflows/codeql-analysis.yaml)
[](./badges/coverage.svg)
Anabolic Codeowners enhances GitHub’s CODEOWNERS functionality, enabling random assignment of code reviewers with per-path granularity. It’s perfect for monorepos, ensuring balanced review workload distribution.
## Features
- Randomly select reviewers from the configured pool to evenly distribute the review load
- Assign reviewers to specific paths or files in your repository, mirroring CODEOWNERS syntax for intuitive setup
- Flexibly set the number of reviewers per pull request to maintain balance between thorough review and efficiency
## Usage
### Definition
Create a workflow `.yaml` under `.github/workflows` like this:
```yaml
name: Assign Reviewers
on:
pull_request:
types:
- opened
- reopened
- ready_for_review
jobs:
assign-reviewers:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Anabolic Codeowners
uses: moltinginstar/anabolic-codeowners@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
config: .github/codeowners.yaml # Configuration file, optional
num-reviewers: 1 # Reviewers per rule, optional
```
### Configuration
To use Anabolic Codeowners, you must also create a configuration file and assign users to specific filepaths. By default, this file will be named `.github/codeowners.yaml`, or you can specify a different location in the workflow manifest. Here’s an example `codeowners.yaml` for an Nx-based monorepo:
```yaml
**/*:
- agile-codehunter
- atomic-committer
apps/app1-api/**/*:
- alluring-creator
# Override the default reviewers for a specific file
apps/app1-api/src/app.module.ts:
- apex-codex
# Exclude specific paths from review
apps/app1-api/src/config/**/*:
apps/app1-api/**/*.(spec|test).ts:
- agile-codehunter
apps/app1-web/**/*:
- anomaly-catcher
- aurora-cascade
- apex-codex
libs/app1-shared/**/*:
- agile-codehunter
- aurora-cascade
```
The last matching rule for a file _overrides_ previous matches. You can use any path specifier supported by [`minimatch`](https://github.com/isaacs/minimatch), including:
- `*` and `**`
- Negative (`!`) patterns
- POSIX character classes (e.g., `[[:alpha:]]`)
- Etc.
## Contributing
Contributions are very welcome! Please submit pull requests or open issues for bugs and feature requests.
## License
Anabolic Codeowners is licensed under the [MIT License](LICENSE).