Merge pull request #29232 from acierto/githubrepocreate

Made "github:repo:create" action idempotent
This commit is contained in:
Ben Lambert
2025-03-17 08:35:30 +01:00
committed by GitHub
2 changed files with 39 additions and 28 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-github': patch
---
Made "github:repo:create" action idempotent
@@ -196,35 +196,41 @@ export function createGithubRepoCreateAction(options: {
});
const client = new Octokit(octokitOptions);
const newRepo = await createGithubRepoWithCollaboratorsAndTopics(
client,
repo,
owner,
repoVisibility,
description,
homepage,
deleteBranchOnMerge,
allowMergeCommit,
allowSquashMerge,
squashMergeCommitTitle,
squashMergeCommitMessage,
allowRebaseMerge,
allowAutoMerge,
access,
collaborators,
hasProjects,
hasWiki,
hasIssues,
topics,
repoVariables,
secrets,
oidcCustomization,
customProperties,
subscribe,
ctx.logger,
);
const remoteUrl = await ctx.checkpoint({
key: `create.repo.and.topics.${owner}.${repo}`,
fn: async () => {
const newRepo = await createGithubRepoWithCollaboratorsAndTopics(
client,
repo,
owner,
repoVisibility,
description,
homepage,
deleteBranchOnMerge,
allowMergeCommit,
allowSquashMerge,
squashMergeCommitTitle,
squashMergeCommitMessage,
allowRebaseMerge,
allowAutoMerge,
access,
collaborators,
hasProjects,
hasWiki,
hasIssues,
topics,
repoVariables,
secrets,
oidcCustomization,
customProperties,
subscribe,
ctx.logger,
);
return newRepo.clone_url;
},
});
ctx.output('remoteUrl', newRepo.clone_url);
ctx.output('remoteUrl', remoteUrl);
},
});
}