From d65f93280813b324346322ae74306d5977160094 Mon Sep 17 00:00:00 2001 From: Den <53200638+localden@users.noreply.github.com> Date: Wed, 2 Dec 2026 00:39:56 +0000 Subject: [PATCH] Prepare two repository renames --- src/github.ts | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/github.ts b/src/github.ts index a744f352..c290fc07 100644 --- a/src/github.ts +++ b/src/github.ts @@ -98,6 +98,16 @@ ORG_ROLE_ASSIGNMENTS.forEach((assignment) => { // @pulumi/github release that includes that fix. const orgRoleTeamNames = [...new Set(ORG_ROLE_ASSIGNMENTS.map((a) => a.team))]; +// Access-only entries that are being renamed, under their old and new names. GitHub redirects +// the old name, so deleting the old resource would remove everyone's access to the repository. +// Pulumi forgets it instead. Deploy this before the rename, and remove the names after it. +const RENAMED_REPOSITORIES = [ + 'experimental-ext-grouping', + 'experimental-ext-triggers-events', + 'ext-events', + 'progressive-disclosure-wg', +]; + // Repositories. An entry with `settings` is created and owned by Pulumi; the // collaborators resource then depends on it through the name output, so a new // repository and its access land in the same apply. Entries without `settings` @@ -132,23 +142,27 @@ REPOSITORY_ACCESS.forEach((repo) => { } const grantedTeams = new Set(repo.teams?.map((t) => t.team)); - new github.RepositoryCollaborators(`repo-${repo.repository}`, { - repository: repositoryName, - // Ignore org-role teams, except where repoAccess.ts grants them directly on - // this repository (e.g. lead-maintainers on maintainer-docs) — those grants - // must stay managed by Pulumi. - ignoreTeams: orgRoleTeamNames - .filter((team) => !grantedTeams.has(team)) - .map((team) => ({ teamId: teams[team].slug })), - teams: repo.teams?.map((t) => ({ - teamId: teams[t.team]?.id, - permission: t.permission, - })), - users: repo.users?.map((u) => ({ - username: u.username, - permission: u.permission, - })), - }); + new github.RepositoryCollaborators( + `repo-${repo.repository}`, + { + repository: repositoryName, + // Ignore org-role teams, except where repoAccess.ts grants them directly on + // this repository (e.g. lead-maintainers on maintainer-docs) — those grants + // must stay managed by Pulumi. + ignoreTeams: orgRoleTeamNames + .filter((team) => !grantedTeams.has(team)) + .map((team) => ({ teamId: teams[team].slug })), + teams: repo.teams?.map((t) => ({ + teamId: teams[t.team]?.id, + permission: t.permission, + })), + users: repo.users?.map((u) => ({ + username: u.username, + permission: u.permission, + })), + }, + { retainOnDelete: RENAMED_REPOSITORIES.includes(repo.repository) } + ); }); export { teams as githubTeams, repositories as githubRepositories };