Skip to content

Commit

Permalink
Merge branch 'releases/v4-flow' of https://github.com/JamesIves/githu…
Browse files Browse the repository at this point in the history
…b-pages-deploy-action into releases/v4-flow
  • Loading branch information
JamesIves committed May 18, 2024
2 parents c1351ae + 2e126d7 commit 60a17ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/worktree.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ function generateWorktree(action, worktreedir, branchExists) {
yield (0, execute_1.execute)(`git worktree remove ${worktreedir}`, action.workspace, action.silent);
}
yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent);
// Check if the branch is already checked out in any worktree
const { stdout: branchList } = yield (0, execute_1.execute)(`git branch`, action.workspace, action.silent);
// If the branch is checked out, remove it
if (branchList.includes(` ${action.branch}`)) {
yield (0, execute_1.execute)(`git branch -D ${action.branch}`, action.workspace, action.silent);
}
const checkout = new GitCheckout(action.branch);
if (branchExists) {
// There's existing data on the branch to check out
Expand Down

0 comments on commit 60a17ba

Please sign in to comment.