CODEOWNERS Collector
Parse CODEOWNERS files to collect structured ownership data including rules, owner types, and catch-all coverage. Enables enforcement of code ownership standards across your organization.
codeowners to your lunar-config.yml:uses: github://earthly/lunar-lib/collectors/codeowners@v1.0.0
What This Integration Collects
This integration includes 1 collector that gather metadata from your systems.
codeowners
Scans the repository for a CODEOWNERS file in standard locations
(CODEOWNERS, .github/CODEOWNERS, docs/CODEOWNERS) and parses
its contents. Extracts ownership rules, validates syntax, classifies
owners as teams vs individuals, and detects catch-all rules. Writes
structured data to .ownership.codeowners.
How Collectors Fit into Lunar
Lunar watches your code and CI/CD systems to collect SDLC data from config files, test results, IaC, deployment configurations, security scans, and more.
Collectors are the automatic data-gathering layer. They extract structured metadata from your repositories and pipelines, feeding it into Lunar's centralized database where guardrails evaluate it to enforce your engineering standards.
Learn How Lunar Works →Example Collected Data
This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:
{
"ownership": {
"codeowners": {
"exists": true,
"valid": true,
"path": ".github/CODEOWNERS",
"errors": [],
"owners": ["@acme/backend-team", "@acme/platform-team", "@jdoe"],
"team_owners": ["@acme/backend-team", "@acme/platform-team"],
"individual_owners": ["@jdoe"],
"rules": [
{
"pattern": "*",
"owners": ["@acme/platform-team"],
"owner_count": 1,
"line": 3
},
{
"pattern": "/src/backend/",
"owners": ["@acme/backend-team", "@jdoe"],
"owner_count": 2,
"line": 6
}
]
}
}
}
Configuration
Configure this collector in your lunar-config.yml.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
paths
|
Optional |
CODEOWNERS,.github/CODEOWNERS,docs/CODEOWNERS
|
Comma-separated list of CODEOWNERS file paths to check (first match wins) |
Documentation
View on GitHubCODEOWNERS Collector
Parses CODEOWNERS files and collects structured code ownership data.
Overview
This collector scans the repository for a CODEOWNERS file in standard locations (CODEOWNERS, .github/CODEOWNERS, docs/CODEOWNERS) and parses its contents into structured JSON. It extracts ownership rules, validates syntax, classifies owners as teams vs individuals, and detects catch-all rules. The search paths are configurable via the paths input.
Collected Data
This collector writes to the following Component JSON paths:
| Path | Type | Description |
|---|---|---|
.ownership.codeowners.exists |
boolean | Whether a CODEOWNERS file exists |
.ownership.codeowners.valid |
boolean | Whether the file has valid syntax (no invalid owner formats) |
.ownership.codeowners.path |
string | Path to the CODEOWNERS file found |
.ownership.codeowners.errors[] |
array | Syntax errors found (each with line, message, content) |
.ownership.codeowners.owners[] |
array | All unique owners referenced across all rules |
.ownership.codeowners.team_owners[] |
array | Owners that are teams (@org/team-name) |
.ownership.codeowners.individual_owners[] |
array | Owners that are individuals (@user or email) |
.ownership.codeowners.rules[] |
array | All parsed rules (each with pattern, owners, owner_count, line) |
Installation
Add to your lunar-config.yml:
collectors:
- uses: github://earthly/lunar-lib/collectors/codeowners@v1.0.0
on: ["domain:your-domain"] # Or use tags like [backend, go]
# with:
# paths: "CODEOWNERS,.github/CODEOWNERS" # Customize search paths
Open Source
This collector is open source and available on GitHub. Contribute improvements, report issues, or fork it for your own use.
Common Use Cases
Explore guardrails that use data from CODEOWNERS Collector.
Ready to Automate Your Standards?
See how Lunar can turn your engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.