Skip to content

Commit bb487ab

Browse files
authored
Prepare two repository renames (#285)
1 parent 559682c commit bb487ab

1 file changed

Lines changed: 31 additions & 17 deletions

File tree

‎src/github.ts‎

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ ORG_ROLE_ASSIGNMENTS.forEach((assignment) => {
9898
// @pulumi/github release that includes that fix.
9999
const orgRoleTeamNames = [...new Set(ORG_ROLE_ASSIGNMENTS.map((a) => a.team))];
100100

101+
// Access-only entries that are being renamed, under their old and new names. GitHub redirects
102+
// the old name, so deleting the old resource would remove everyone's access to the repository.
103+
// Pulumi forgets it instead. Deploy this before the rename, and remove the names after it.
104+
const RENAMED_REPOSITORIES = [
105+
'experimental-ext-grouping',
106+
'experimental-ext-triggers-events',
107+
'ext-events',
108+
'progressive-disclosure-wg',
109+
];
110+
101111
// Repositories. An entry with `settings` is created and owned by Pulumi; the
102112
// collaborators resource then depends on it through the name output, so a new
103113
// repository and its access land in the same apply. Entries without `settings`
@@ -132,23 +142,27 @@ REPOSITORY_ACCESS.forEach((repo) => {
132142
}
133143

134144
const grantedTeams = new Set(repo.teams?.map((t) => t.team));
135-
new github.RepositoryCollaborators(`repo-${repo.repository}`, {
136-
repository: repositoryName,
137-
// Ignore org-role teams, except where repoAccess.ts grants them directly on
138-
// this repository (e.g. lead-maintainers on maintainer-docs) — those grants
139-
// must stay managed by Pulumi.
140-
ignoreTeams: orgRoleTeamNames
141-
.filter((team) => !grantedTeams.has(team))
142-
.map((team) => ({ teamId: teams[team].slug })),
143-
teams: repo.teams?.map((t) => ({
144-
teamId: teams[t.team]?.id,
145-
permission: t.permission,
146-
})),
147-
users: repo.users?.map((u) => ({
148-
username: u.username,
149-
permission: u.permission,
150-
})),
151-
});
145+
new github.RepositoryCollaborators(
146+
`repo-${repo.repository}`,
147+
{
148+
repository: repositoryName,
149+
// Ignore org-role teams, except where repoAccess.ts grants them directly on
150+
// this repository (e.g. lead-maintainers on maintainer-docs) — those grants
151+
// must stay managed by Pulumi.
152+
ignoreTeams: orgRoleTeamNames
153+
.filter((team) => !grantedTeams.has(team))
154+
.map((team) => ({ teamId: teams[team].slug })),
155+
teams: repo.teams?.map((t) => ({
156+
teamId: teams[t.team]?.id,
157+
permission: t.permission,
158+
})),
159+
users: repo.users?.map((u) => ({
160+
username: u.username,
161+
permission: u.permission,
162+
})),
163+
},
164+
{ retainOnDelete: RENAMED_REPOSITORIES.includes(repo.repository) }
165+
);
152166
});
153167

154168
export { teams as githubTeams, repositories as githubRepositories };

0 commit comments

Comments
 (0)