Skip to content

feat: add reusable CODEOWNERS suggested-reviewer workflows - #556

Draft
kajalj22 wants to merge 1 commit into
mainfrom
add-suggest-reviewers-templates
Draft

feat: add reusable CODEOWNERS suggested-reviewer workflows#556
kajalj22 wants to merge 1 commit into
mainfrom
add-suggest-reviewers-templates

Conversation

@kajalj22

Copy link
Copy Markdown
Contributor

Summary

  • Adds _suggest_reviewers.yml — a workflow_call workflow that requests reviewers on a PR from # suggest: <pattern> @owner ... comment lines layered on top of a repo's .github/CODEOWNERS. Comment lines are invisible to GitHub's own CODEOWNERS parser, so these can never become required/blocking reviewers no matter what branch protection does — purely advisory, alongside whatever the repo already enforces.
  • Adds _validate_codeowners_suggestions.yml — runs the shared matcher's unit tests, warns (non-blocking) on redundant CODEOWNERS rules, and verifies every # suggest:-referenced user (directly, or via a suggested team's membership) is a current NVIDIA-NeMo org member. Reuses check-nvidia-sso + NVIDIA_MANAGEMENT_ORG_PAT, already used elsewhere in this repo (_cicd_preflight.yml).
  • Adds .github/scripts/codeowners-suggestions.js, the shared pattern-matching/parsing logic, with its own node --test suite (codeowners-suggestions.test.js) — both workflows require the same module rather than duplicating matching logic inline.

Motivation

First consumer is NVIDIA-NeMo/Gym (see companion PR), which wanted PR-level reviewer suggestions that are explicitly non-enforced, on top of its existing enforced CODEOWNERS. Built here instead of repo-local so any NeMo repo with a CODEOWNERS file can adopt it the same way other _*.yml reusable workflows are consumed.

Test plan

  • node --test .github/scripts/codeowners-suggestions.test.js passes locally (14/14)
  • Consuming repo (Gym) PR exercises both workflows end-to-end: suggestion requested for a matched individual and a matched team, redundant-rule warning fires, org-membership check fails for a non-member test entry

Adds two workflow_call workflows, usable by any NeMo repo that keeps
a .github/CODEOWNERS file:

- _suggest_reviewers.yml: requests reviewers on a PR from `# suggest:`
  comment lines in CODEOWNERS (a GitHub-native, non-blocking
  extension of the enforced CODEOWNERS syntax -- GitHub's own parser
  ignores comment lines, so these can never become required
  reviewers). Skips a suggestion already covered by enforcement,
  either textually or via team membership. Alerts Slack (via the
  existing send-slack-alert action) if the batch request fails,
  without failing the workflow.

- _validate_codeowners_suggestions.yml: runs the shared matcher's own
  unit tests, warns on redundant CODEOWNERS rules, and verifies every
  `# suggest:` user/team-member is a current NVIDIA-NeMo org member
  (reusing check-nvidia-sso + NVIDIA_MANAGEMENT_ORG_PAT, already used
  elsewhere in this repo).

The pattern-matching/parsing logic lives in
.github/scripts/codeowners-suggestions.js, shared by both workflows
and covered by its own test file.

Signed-off-by: Kajal Jain <kajalj@nvidia.com>
kajalj22 added a commit to NVIDIA-NeMo/Gym that referenced this pull request Aug 22, 2026
Replace the Gym-local implementation with thin callers into
NVIDIA-NeMo/FW-CI-templates#556 (_suggest_reviewers.yml and
_validate_codeowners_suggestions.yml), so the same CODEOWNERS
`# suggest:` convention is reusable by any NeMo repo instead of
duplicated per-repo. Pinned to that PR's branch SHA for now; update
to a released tag once it merges.

.github/CODEOWNERS itself stays in this repo, since ownership data is
repo-specific.

Signed-off-by: Kajal Jain <kajalj@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant