Skip to content

Add support for Kubernetes-style OWNERS_ALIASES #764

Todo

Description

@moficodes

Is your feature request related to a problem? Please describe.
Repositories with multiple directory-scoped OWNERS files often share the same groups of reviewers and approvers across directories. Right now OWNERS_ALIASES is not read (docs/prow-for-your-org.md), leaving two options:

  1. Duplicate individual GitHub handles across every OWNERS file.
  2. Use @org/team groups (Add support for GitHub Groups to the Approve plugin #485 / feat(owners): support GitHub groups in OWNERS #486), which requires managing membership in GitHub's org UI (outside PR review / git history) and supplying a custom token with org-level Members: read (read:org) instead of the default GITHUB_TOKEN.

Supporting Kubernetes-style OWNERS_ALIASES gives repositories git-reviewed, reusable owner groups that work out of the box with GITHUB_TOKEN (contents: read).

Describe the solution you'd like
Read an optional OWNERS_ALIASES file at the repository root in standard Kubernetes Prow YAML format:

aliases:
  sig-api-approvers:
    - alice
    - bob
  sig-api-reviewers:
    - carol

When an OWNERS file lists an alias name under approvers or reviewers, expand it to its member logins everywhere OWNERS are evaluated:

  • Pull request ownership (loadPullRequestOwners / loadOwnersTree + probeOwners when truncated): read OWNERS_ALIASES from the same base-branch tip commit (baseSha) as OWNERS so a PR cannot modify its own aliases, memoized per ref in RunState. This automatically covers /approve, /lgtm, trigger (/retest, /test, /ok-to-test), the approve plugin ([APPROVALNOTIFIER] + suggestApprovers + approve.github_review), and blunderbuss.
  • Issue / root-OWNERS authorization (src/utils/auth.ts: assertRootOwner and rootOwnersIncludes for authorization: trusted): read OWNERS_ALIASES from the default branch (memoized in RunState) and expand in ownersInclude after the direct-listing fast path.
  • Keep branchHasOwners / repoHasOwners matching OWNERS files only so a repo with only OWNERS_ALIASES does not enable OWNERS mode.
  • Case-insensitive matching on both alias names and member logins, matching parseOwners and Prow.
  • Zero extra API calls when OWNERS_ALIASES is absent from a non-truncated git tree (one memoized blob fetch when present).

Design questions to align on before opening a PR

  1. Malformed OWNERS_ALIASES: Should invalid YAML or a non-string-list alias entry fail closed (throw, matching parseOwners in src/utils/owners.ts), or warn and treat as empty (matching upstream Prow's loadAliasesFrom)? And should an empty/whitespace-only file or alias: (null) be treated as empty ([]), matching parseOwners?
  2. Nested aliases: Should expansion be single-level (matching upstream Prow's RepoAliases.ExpandAliases) or recursive with cycle detection?
  3. Alias / username collision: Match upstream Prow's replacement semantics (if an entry matches an alias key, replace it with the alias's members rather than keeping the alias key as a literal login)?
  4. Interaction with @org/team: Expand aliases before expandGroups so an alias can reference @org/team entries, or keep aliases to plain logins only?

Describe alternatives you've considered

  • @org/team in OWNERS (feat(owners): support GitHub groups in OWNERS #486): Great for org-wide teams, but requires a PAT/App token with org Members: read and keeps membership changes outside git review.
  • Generating OWNERS from OWNERS.in + OWNERS_ALIASES via a repo script in CI: Works as a temporary workaround, but adds generator scripts and boilerplate diff noise to every adopting repository.

Additional context
Happy to open a PR with the implementation, unit tests, dist/index.js bundle e2e tests, and doc updates (docs/prow-for-your-org.md, docs/commands.md, and __tests__/docsYamlExamples.test.ts) once the edge cases above are agreed on.

Activity

  1. moficodes commented on Nov 26, 2026

    @moficodes
    Author

    /kind feature

  2. added
    kind/feature
    and removed on Nov 26, 2026
  3. moficodes commented on Nov 26, 2026

    @moficodes
    Author
  4. moficodes commented on Nov 26, 2026

    @moficodes
    Author

    /assign mrbobbytables

  5. added
    stage/010-actionable
    stage/040-covered-by-pr
    and removed
    stage/010-actionable
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featurestage/040-covered-by-pr

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions