grafana/scripts/codeowners-manifest
Jesse David Peterson 374eaf5797
Tests: Bootstrapping for CI workflow to compare PR test coverage with main (#116500)
* feat(script): dasherize codeowner names for GHA safe artifact slugs

* feat(script): emit coverage summary report JSON from test runner

* feat(script): compare code coverage between a PR and main by codeowner

* feat(ci): skeleton of future workflow to compare code coverage

* chore(codeowners): the DataViz team owns now code coverage checks
2026-01-19 14:48:52 -04:00
..
constants.js Tests: Custom script to run unit tests filtered by code ownership (#111210) 2025-10-07 17:07:55 -04:00
generate.js Tests: Custom script to run unit tests filtered by code ownership (#111210) 2025-10-07 17:07:55 -04:00
index.js Coverage: Add some DX improvements to by codeowner script (#112673) 2025-10-22 15:09:39 -04:00
metadata.js Tests: Custom script to run unit tests filtered by code ownership (#111210) 2025-10-07 17:07:55 -04:00
raw.js Tests: Custom script to run unit tests filtered by code ownership (#111210) 2025-10-07 17:07:55 -04:00
README.md Tests: Custom script to run unit tests filtered by code ownership (#111210) 2025-10-07 17:07:55 -04:00
utils.js Tests: Bootstrapping for CI workflow to compare PR test coverage with main (#116500) 2026-01-19 14:48:52 -04:00

Codeowners Manifest Scripts

Scripts for generating and caching CODEOWNERS manifest data.

Each of these scripts can be run individually if needed, but index.js is most useful because it combines them all.

Usage

# Combined script
node index.js     # Generate complete manifest with caching

# Individual scripts
node metadata.js  # Generate metadata with hashes
node raw.js       # Generate raw audit data
node generate.js  # Process raw data into manifest files

Control flow of index.js

flowchart TD
    A[index.js] --> B[metadata.js: Generate new metadata]
    B --> C{Existing metadata exists?}
    C -->|No| D[Generate all files]
    C -->|Yes| E{Hashes match?}
    E -->|No| D
    E -->|Yes| F[Skip generation]

    D --> G[raw.js: Generate audit data]
    G --> H[generate.js: Process into JSON files]
    H --> I[Save new metadata]
    I --> J[Complete]

    F --> J

    style F fill:#e1f5fe
    style J fill:#e8f5e8

Default output

By default these scripts will write the following files to the /codeowners-manifest/* directory.

  • audit-raw.jsonl - Raw CODEOWNERS audit data in JSONL format (for fast stream processing)
  • teams.json - List of all codeowners (for validating codeowner names)
  • teams-by-filename.json - Files mapped to their respective codeowners
  • filenames-by-team.json - Codeowners mapped to their respective files
  • metadata.json - Hashes for cache validation