Hamburger Cross Icon
CODEOWNERS Collector - Lunar Collector

CODEOWNERS Collector

Collector Stable Vcs

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.

Add 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.

Collector code

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.

codeowners code ownership repository ownership team ownership file ownership pull request reviewers
Book a demo

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
1
Collectors Gather Data This Integration
Triggered by code changes or CI pipelines, collectors extract metadata from config files, tool outputs, test results, and scans
2
{ } Centralized as JSON
All data merged into each component's unified metadata document
3
Guardrails Enforce Standards
Real-time feedback in PRs and AI workflows

Example Collected Data

This collector writes structured metadata to the Component JSON. Here's an example of the data it produces:

{ } component.json Component JSON
{
  "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 GitHub

CODEOWNERS 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.

View Repository

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.

Works with any process
check Infrastructure conventions
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Turn any process doc into guardrails
Book a Demo