fix: double branch creation in public:bitbucket{Cloud,Server}:pull-request

Signed-off-by: RedlineTriad <39059512+RedlineTriad@users.noreply.github.com>
This commit is contained in:
RedlineTriad
2024-10-24 17:14:27 +02:00
parent b1dbdddc87
commit 9cf827cada
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,