Made "github:repo:push" action idempotent
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-github': patch
|
||||
---
|
||||
|
||||
Made "github:repo:push" action idempotent
|
||||
@@ -165,34 +165,40 @@ export function createGithubRepoPushAction(options: {
|
||||
const remoteUrl = targetRepo.data.clone_url;
|
||||
const repoContentsUrl = `${targetRepo.data.html_url}/blob/${defaultBranch}`;
|
||||
|
||||
const { commitHash } = await initRepoPushAndProtect(
|
||||
remoteUrl,
|
||||
octokitOptions.auth,
|
||||
ctx.workspacePath,
|
||||
ctx.input.sourcePath,
|
||||
defaultBranch,
|
||||
protectDefaultBranch,
|
||||
protectEnforceAdmins,
|
||||
owner,
|
||||
client,
|
||||
repo,
|
||||
requireCodeOwnerReviews,
|
||||
bypassPullRequestAllowances,
|
||||
requiredApprovingReviewCount,
|
||||
restrictions,
|
||||
requiredStatusCheckContexts,
|
||||
requireBranchesToBeUpToDate,
|
||||
requiredConversationResolution,
|
||||
requireLastPushApproval,
|
||||
config,
|
||||
ctx.logger,
|
||||
gitCommitMessage,
|
||||
gitAuthorName,
|
||||
gitAuthorEmail,
|
||||
dismissStaleReviews,
|
||||
requiredCommitSigning,
|
||||
requiredLinearHistory,
|
||||
);
|
||||
const commitHash = await ctx.checkpoint({
|
||||
key: `init.repo.publish.${owner}.${client}.${repo}`,
|
||||
fn: async () => {
|
||||
const { commitHash: hash } = await initRepoPushAndProtect(
|
||||
remoteUrl,
|
||||
octokitOptions.auth,
|
||||
ctx.workspacePath,
|
||||
ctx.input.sourcePath,
|
||||
defaultBranch,
|
||||
protectDefaultBranch,
|
||||
protectEnforceAdmins,
|
||||
owner,
|
||||
client,
|
||||
repo,
|
||||
requireCodeOwnerReviews,
|
||||
bypassPullRequestAllowances,
|
||||
requiredApprovingReviewCount,
|
||||
restrictions,
|
||||
requiredStatusCheckContexts,
|
||||
requireBranchesToBeUpToDate,
|
||||
requiredConversationResolution,
|
||||
requireLastPushApproval,
|
||||
config,
|
||||
ctx.logger,
|
||||
gitCommitMessage,
|
||||
gitAuthorName,
|
||||
gitAuthorEmail,
|
||||
dismissStaleReviews,
|
||||
requiredCommitSigning,
|
||||
requiredLinearHistory,
|
||||
);
|
||||
return hash;
|
||||
},
|
||||
});
|
||||
|
||||
ctx.output('remoteUrl', remoteUrl);
|
||||
ctx.output('repoContentsUrl', repoContentsUrl);
|
||||
|
||||
Reference in New Issue
Block a user