Merge pull request #27343 from RedlineTriad/fix-bitbucket-double-branch-creation

fix: double branch creation in `public:bitbucket{Cloud,Server}:pull-r…
This commit is contained in:
Johan Haals
2024-10-25 14:12:25 +02:00
committed by GitHub
3 changed files with 13 additions and 16 deletions
+13
View File
@@ -0,0 +1,13 @@
---
'@backstage/plugin-scaffolder-backend-module-bitbucket-server': patch
'@backstage/plugin-scaffolder-backend-module-bitbucket-cloud': patch
---
Fix double branch creation in `public:bitbucket{Cloud,Server}:pull-request`
This resulted in the following error when using the actions:
```
AlreadyExistsError: Failed to create branch at create-test because it already exists.
```
The issue was original introduced in d103a48fa306d745599dc0c793668c9e6a479d32
@@ -21,7 +21,6 @@ import {
getRepoSourceDirectory,
commitAndPushBranch,
addFiles,
createBranch as createGitBranch,
cloneRepo,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
@@ -412,13 +411,6 @@ export function createPublishBitbucketCloudPullRequestAction(options: {
ref: sourceBranch,
});
await createGitBranch({
dir: tempDir,
auth,
logger: ctx.logger,
ref: sourceBranch,
});
// copy files
fs.cpSync(sourceDir, tempDir, {
recursive: true,
@@ -24,7 +24,6 @@ import {
getRepoSourceDirectory,
commitAndPushBranch,
addFiles,
createBranch as createGitBranch,
cloneRepo,
parseRepoUrl,
} from '@backstage/plugin-scaffolder-node';
@@ -452,13 +451,6 @@ export function createPublishBitbucketServerPullRequestAction(options: {
ref: sourceBranch,
});
await createGitBranch({
dir: tempDir,
auth,
logger: ctx.logger,
ref: sourceBranch,
});
// copy files
fs.cpSync(sourceDir, tempDir, {
recursive: true,