fix: handle branches betterer
Node.js CI / CI (push) Has been cancelled
Security Scan and Upload / Security & DefectDojo Upload (push) Has been cancelled

This commit is contained in:
2026-02-03 19:25:50 -08:00
parent 0dbedfe546
commit 565581570c
2 changed files with 49 additions and 2 deletions
+11 -2
View File
@@ -224,8 +224,17 @@ const handleExistingBranch = async(
= options;
const { path: repoPath } = clonedRepo;
await runGitCommand(logger, repoPath, `git checkout ${branchName}`);
await runGitCommand(logger, repoPath, `git pull origin ${branchName}`);
// Delete local branch if it exists (stale from previous run)
const localBranches = await runGitCommand(logger, repoPath, "git branch");
if (localBranches.includes(branchName)) {
await runGitCommand(logger, repoPath, `git branch -D ${branchName}`);
}
await runGitCommand(
logger,
repoPath,
`git checkout -b ${branchName} origin/${branchName}`,
);
const currentVersion = await getCurrentVersionOnBranch(repoPath, packageName);