Repository navigation
feat(owners): support GitHub groups in OWNERS - #486
Conversation
List a team of the repository's org as @org/team; its members are resolved through the teams API. Other orgs' groups are ignored. Hive-Run: #485 Hive-Plan: owners-github-groups Hive-Spec: owners#github-groups Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
|
/kind feature |
|
Test coverage note (quality, hold-gated mode) — e2e only; nothing here blocks the PR.
Below is a bundle scenario that closes it, verified against this branch's committed I can't push to your branch, so it's here to drop in as
|
mrbobbytables
left a comment
There was a problem hiding this comment.
Review (posted as a comment since the author cannot request changes on their own PR). Design is sound and complete: every OWNERS consumer (approve, blunderbuss, /lgtm//approve auth, root-OWNERS trusted policy) goes through perFile or the two root helpers, all of which expand groups; OWNERS still come from the base-branch tip so a PR cannot grant itself a team; one teams-API call per team per run. Two things to fix, three suggestions — fixes follow in a commit on this branch.
Should fix
- Warning spam.
owners.ts:131core.warning(…ignoring group…)runs on everyexpandGroupscall, andpullRequestOwners.ts:86calls it twice per changed file, so a 50-file PR touching an OWNERS with@other/teamemits ~100 identical warnings. Warn once per entry. - Docs understate the token requirement.
teams.listMembersInOrgneeds org-level Members: read; the defaultGITHUB_TOKENhas no org permissions, so with the stockprow-bot.ymlevery group silently expands to nobody.docs/commands.mdshould say outright thatGITHUB_TOKENwill not do and thetokensecret (PATread:org/ App Organization → Members: read) is required;docs/prow-for-your-org.md:189-191(the "OWNERS_ALIASES … not supported" paragraph) and the day-one-surprises table should point at groups too.
Suggestions
rootOwnersIncludes/assertRootOwnernow call the teams API before checking plain logins; underauthorization: trustedthat is every command. Check direct membership first, expand only on a miss.- Only
expandGroupsis unit-tested; nothing coversexpandOwnersSet, thepullRequestOwnerswiring or theauth.tschanges, and there is no bundle scenario. Add one routingGET /orgs/{org}/teams/{slug}/membersthroughdist/index.js. @alice(no slash) is kept as a literal login that can never match. Now that@is meaningful, a malformed entry deserves a warning.
…stings - expandGroups warned on every call, and the per-file expansion calls it twice per changed file, so one foreign-org group in a root OWNERS file produced a warning per file per role. Warn once per entry per run. - An `@…` entry that is not `@<org>/<team-slug>` used to be kept as a literal login that can never match; drop it with a warning. - ownersInclude answers a directly listed login before reading any team, so the root-OWNERS authorization path makes no teams-API call in the common case. - Docs: the default GITHUB_TOKEN has no organization permissions, so groups need the `token` secret with Members: read; say so in commands, installing and the day-one surprises table, and point the OWNERS_ALIASES note at groups. - Tests: unit cases for the dedupe, the malformed entry, expandOwnersSet and ownersInclude; a bundle file driving all four arms through dist/index.js. dist/ repacked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
|
Pushed d58e18f addressing all five review points:
|
The previous repack came from a node_modules that still held js-yaml 5.4.2; CI's fresh npm ci bundles 5.4.3 (#440), so the drift gate failed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
…OWNERS approver case (#491) - sweepSharedMemos.test.ts held one case and copies of sweepArms' forkPr/runSweep and of helpers.ts routeOwners. Move the case into sweepArms.test.ts, built from that file's forkPr/routeList/runSweep and routeOwners; every assertion is kept and it still alone reaches the tokenIdentity and baseBranchTip memo-hit arms. - authorizationPolicyArms: since #486 the approver case reaches the same ownersInclude arm as the reviewer case above it, and the regression it guards (rootOwnersIncludes reading reviewers only) fails auth.test.ts 'policyAllows a root OWNERS approver'. E2E line and branch-arm sets are unchanged. Signed-off-by: Jeffrey Sica <me@jeefy.dev>
Closes #485
OWNERS
approvers/reviewersmay now list"@org/team"entries. Members are resolved via the teams API (memoized per run) wherever OWNERS are evaluated (/approve, /lgtm, approve plugin, blunderbuss, root-OWNERS auth). Groups from other orgs or unreadable teams are ignored with a warning. Docs, tests and dist updated.— hive: backend=copilot model=claude-sonnet-5.5
🐝 Hive Agent:
contributor| SHA:05f387b