Skip to content

Commit aa7a59d

Browse files
authored
fix(maintainer): use affiliation=all for repo collaborators (#198)
Org-owned repos whose members are private (the GitHub default) resolved to an empty maintainer set and were skipped by MaintainerPopulateService, because affiliation=direct only returns users explicitly added to the repo — it excludes insiders who get access via a team or org base permission, and /orgs/{org}/members only exposes public members to the app token. Switch the collaborators fetch to affiliation=all so any insider with repo access is captured. The live maintainers table is meant to reproduce GitHub's author_association (OWNER/MEMBER/COLLABORATOR), which marks org insiders as maintainers regardless of how access was granted, so this is the faithful set — not a permission-level reinterpretation. Fixes gittensor-ai-lab/sparkinfer showing zero maintainers.
1 parent eb214a6 commit aa7a59d

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

packages/das/src/webhook/github-fetcher.service.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,18 +252,23 @@ export class GitHubFetcherService implements OnModuleInit {
252252
// --- REST: live maintainer roles (collaborators + org members) ---
253253

254254
/**
255-
* Direct collaborators on the repo, returned as COLLABORATOR. The reconciler
256-
* upgrades org members to MEMBER and the repo owner to OWNER. affiliation=direct
257-
* excludes access inherited purely through org base permissions, so this is
258-
* the set of users explicitly granted access to the repo.
255+
* Collaborators on the repo, returned as COLLABORATOR. The reconciler upgrades
256+
* org members to MEMBER and the repo owner to OWNER. We use affiliation=all (not
257+
* =direct) so access granted via a team or org base permission is included, not
258+
* just users explicitly added to the repo. This is deliberate: the live
259+
* maintainers table must reproduce GitHub's author_association (OWNER / MEMBER /
260+
* COLLABORATOR), which marks any org insider with repo access as a maintainer
261+
* regardless of how that access was granted. affiliation=direct missed
262+
* team/base-permission insiders, so org-owned repos whose members are private
263+
* (the GitHub default) resolved to an empty maintainer set and were skipped.
259264
*/
260265
async fetchRepoCollaborators(
261266
repoFullName: string,
262267
): Promise<MaintainerRole[]> {
263268
const token = await this.getTokenForRepo(repoFullName);
264269
const [owner, repo] = repoFullName.split("/");
265270
const users = await this.restGetAllPages(
266-
`https://api.github.com/repos/${owner}/${repo}/collaborators?affiliation=direct&per_page=100`,
271+
`https://api.github.com/repos/${owner}/${repo}/collaborators?affiliation=all&per_page=100`,
267272
token,
268273
);
269274
return users.map((u: any) => ({

0 commit comments

Comments
 (0)