Skip to content

Commit e53fad2

Browse files
claude[bot]claude
andauthored
Ignore org-role teams in RepositoryCollaborators to unblock deploys (#179)
GitHub's list-repository-teams API now also returns teams whose access comes from an organization role (orgRoles.ts: lead-maintainers and core-maintainers hold all_repo_admin, security-managers holds security_manager). During `pulumi up --refresh` the provider reads these teams as direct collaborators on every repository, then tries to DELETE the direct team-repo association where repoAccess.ts does not grant it — and GitHub 404s because no direct association exists. This broke every deploy starting with run #253 (first failure on experimental-ext-skills, where refresh picked up lead-maintainers). The pinned @pulumi/github 6.12.1 provider predates the upstream fix that skips non-direct teams (integrations/terraform-provider-github#3571), so work around it by passing ignoreTeams for the org-role-holding teams on each RepositoryCollaborators resource — except teams the repository's repoAccess.ts entry grants directly (e.g. lead-maintainers on maintainer-docs), which must stay managed by Pulumi. Remove this workaround once a @pulumi/github release including the upstream fix is adopted. Claude-Session: https://claude.ai/code/session_01H4JKj5FVkmj6bRzgh1GPrY Co-authored-by: Claude <noreply@anthropic.com>
1 parent cdfa19b commit e53fad2

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/github.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,28 @@ ORG_ROLE_ASSIGNMENTS.forEach((assignment) => {
8686
});
8787
});
8888

89+
// Teams that hold organization-level roles (ORG_ROLE_ASSIGNMENTS above). GitHub's
90+
// list-repository-teams API now also returns teams whose access comes from an org
91+
// role, so a refresh reads them as direct collaborators on every repository and the
92+
// provider then fails trying to delete the non-existent direct association (404).
93+
// The pinned @pulumi/github 6.12.1 provider predates the upstream fix that skips
94+
// non-direct teams (https://github.com/integrations/terraform-provider-github/pull/3571),
95+
// so we tell the provider to ignore these teams on every repository that does not
96+
// grant them directly in repoAccess.ts. Remove this workaround once we upgrade to a
97+
// @pulumi/github release that includes that fix.
98+
const orgRoleTeamNames = [...new Set(ORG_ROLE_ASSIGNMENTS.map((a) => a.team))];
99+
89100
// Configure repository access
90101
REPOSITORY_ACCESS.forEach((repo) => {
102+
const grantedTeams = new Set(repo.teams?.map((t) => t.team));
91103
new github.RepositoryCollaborators(`repo-${repo.repository}`, {
92104
repository: repo.repository,
105+
// Ignore org-role teams, except where repoAccess.ts grants them directly on
106+
// this repository (e.g. lead-maintainers on maintainer-docs) — those grants
107+
// must stay managed by Pulumi.
108+
ignoreTeams: orgRoleTeamNames
109+
.filter((team) => !grantedTeams.has(team))
110+
.map((team) => ({ teamId: teams[team].slug })),
93111
teams: repo.teams?.map((t) => ({
94112
teamId: teams[t.team]?.id,
95113
permission: t.permission,

0 commit comments

Comments
 (0)