ci: don't flag private org members as external contributors#238
ci: don't flag private org members as external contributors#238teeohhem wants to merge 1 commit into
Conversation
author_association only reports MEMBER for *public* org members, so a teammate with private (concealed) membership was classified as external, alerted to Slack, and labeled. Resolve actual repo access via the collaborator-permission endpoint as a fallback. Threshold on granted access (triage and up) rather than permission != 'none', since public repos grant everyone implicit read. Uses the built-in GITHUB_TOKEN; no new secret or permission required. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Deep Review✅ No critical issues found. The change correctly fixes the stated bug: private org members (who report as 🟡 P2 — recommended
🔵 P3 nitpicks (1)
Reviewers (5): correctness, security, reliability, maintainability, project-standards. Testing gaps: No coverage exercising the new slow path — a private member resolving to internal via |
Teammates with private (concealed) organization membership are no longer misflagged as external contributors. They previously got a Slack alert and an
externallabel on every issue/PR they opened, becauseauthor_associationonly reportsMEMBERfor publicly visible members — a private member shows up asCONTRIBUTOR/NONE, which the workflow treated as external.The internal check now keeps
author_associationas a free fast path, then falls back to resolving the author's actual repository permission viarepos.getCollaboratorPermissionLevel. That resolves access granted through private teams, whichauthor_associationcannot see.Two design points worth noting:
permission !== 'none'. This is a public repo, so GitHub grants every user implicitread. A naive!= 'none'check would mark every genuine external contributor as internal. The check requirestriage/push/maintain/admininstead.GITHUB_TOKENcan call the endpoint under the existingissues:write/pull-requests:writescope.Both behaviors were verified in a throwaway Actions run before writing this fix: a private member with
writeaccess resolved to INTERNAL with no403, and a non-collaborator (octocat, implicitread) correctly resolved to EXTERNAL.