Skip to content

Repository files navigation

Cleo Codeowners

Manage your github CODEOWNERS files across multiple teams and features.

Summary

cleo_codeowners builds GitHub CODEOWNERS from small YAML files. Keep owners, features, and file globs in .cleo/codeowners/**/*.yml; generate .github/CODEOWNERS and .github/CODEOWNERS-HUMAN.

Installation

gem install cleo_codeowners

Or add it to your Gemfile:

gem"cleo_codeowners"

In Rails, the gem adds a rake task:

bin/rails codeowners:generate

Configuration

Set the GitHub organization name before generating CODEOWNERS.

In a Rails app, add an initializer:

# config/initializers/codeowners.rbCodeowners.configuredo |config|
config.organization_name="my_org"end

In a non-Rails app, configure Codeowners in the Rakefile while setting up the rake task:

# Rakefilerequire"cleo_codeowners"Codeowners.configuredo |config|
config.organization_name="my_org"endtask:environmentloadGem.loaded_specs["cleo_codeowners"].full_gem_path + "/lib/tasks/codeowners.rake"

Writing your codeowners files

Create YAML files under .cleo/codeowners/.

# .cleo/codeowners/features.ymlfeatures:
session management:
session expiry:
billing:
# .cleo/codeowners/owners.ymlowners:
session management: identity-platformbilling: payments

Child features inherit their parent owner unless they define one.

# .cleo/codeowners/files/session_management.ymlfiles:
session management:
- /app/controllers/sessions/
- /app/models/session.rbsession expiry:
- /app/services/session_expiry/# .cleo/codeowners/files/billing.ymlfiles:
billing:
- /app/controllers/billing/
- /app/models/invoice.rb

Generate:

bin/rails codeowners:generate

Inspect:

cleo-codeowners find_feature app/models/session.rb
cleo-codeowners find_owner app/models/session.rb --glob
cleo-codeowners find_unowned_files --pattern='app/**/*.rb' --exit-status-on-match=1
cleo-codeowners find_contributors "session management" --max-commits=100

Development

Requires Ruby >= 3.2.0.

Install missing gems:

gem install rake thor activesupport mocha minitest

Run tests:

rake test

License

MIT

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages