fix: branch name parsing
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:29:42 -08:00
parent 565581570c
commit 4a8973a6e8
+10 -2
View File
@@ -225,8 +225,16 @@ const handleExistingBranch = async(
const { path: repoPath } = clonedRepo;
// Delete local branch if it exists (stale from previous run)
const localBranches = await runGitCommand(logger, repoPath, "git branch");
if (localBranches.includes(branchName)) {
const localBranchOutput = await runGitCommand(logger, repoPath, "git branch");
const localBranchNames = localBranchOutput.
split("\n").
map((line) => {
return line.replace(/^\*?\s*/, "").trim();
}).
filter((name) => {
return name.length > 0;
});
if (localBranchNames.includes(branchName)) {
await runGitCommand(logger, repoPath, `git branch -D ${branchName}`);
}