Owners
The owners plugin writes a CODEOWNERS file from the owners you give each project, by its name, its folder or its tags. axle sync writes it, and axle sync --check in CI fails when a new project or a changed tag leaves it out of date, so reviews always go to the right people. It’s written in TypeScript with the plugin kit.
Add it
Section titled “Add it”axle add ownersThen say who owns what under [plugins.owners] in the root axle.toml:
[plugins.owners]source = "npm:@axle-rs/plugin-owners@0.1.0"hash = "sha256-…"default = ["@acme/maintainers"]
[plugins.owners.tags]"team:web" = ["@acme/web"]"team:billing" = ["@acme/billing", "@ana"]
[plugins.owners.folders]"docs" = ["@acme/writers"]
[plugins.owners.projects]design-system = ["@acme/design"]and run:
axle syncSettings
Section titled “Settings”| Key | Meaning |
|---|---|
format |
which file to write: github, the default, writes .github/CODEOWNERS, gitlab writes CODEOWNERS and bitbucket writes .bitbucket/CODEOWNERS; a list writes each |
default |
the owners of everything no other line covers, written as * |
projects |
owners by project name |
folders |
owners by folder, relative to the root; a folder doesn’t have to be a project, such as docs |
tags |
owners by tag; a project with several tags gets the owners of each |
tagPrefix |
the start of a tag that names an owner itself, owner: by default, or false to read no owners from tags |
Owners are written as they are, so use what your host understands: @user, @org/team or an email address on GitHub, @user or @group on GitLab, and @user or @team on Bitbucket.
A project can name its own owners in its axle.toml with tags that start with tagPrefix:
tags = ["type:lib", "owner:@acme/design"]When more than one setting covers a project’s folder, the most specific wins: its name under projects, then its folder under folders, then its tags, whose owners are put together.
The file
Section titled “The file”# Written by Axle's owners plugin from [plugins.owners] in axle.toml.# Don't edit it: change the settings, then run axle sync.
* @acme/maintainers/docs/ @acme/writers/apps/web/ @acme/web/packages/billing/ @acme/billing @ana/packages/design/ @acme/designThe last line that matches a file decides its owners, in each format, so the plugin writes * first, then each folder from the shallowest to the deepest: a project inside another project’s folder comes after it and wins for its own files. Spaces in a folder are escaped. Every run writes the same file for the same repository, so axle sync --check only fails when an owner changed.
A setting the plugin can’t use, such as an owner that isn’t a list or a name under projects that isn’t a project, stops axle sync with the plugin’s message.