From a25f306bfe04238ccc2d50889df6f17191f7ea39 Mon Sep 17 00:00:00 2001 From: Arpita Patel Date: Fri, 17 May 2024 15:40:12 -0500 Subject: [PATCH] Update cd_pipeline.yml --- .github/workflows/cd_pipeline.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd_pipeline.yml b/.github/workflows/cd_pipeline.yml index 62a1cac..d0b8cde 100644 --- a/.github/workflows/cd_pipeline.yml +++ b/.github/workflows/cd_pipeline.yml @@ -31,10 +31,13 @@ jobs: echo "Removing existing temp deployment folder" git worktree remove github-pages-deploy-action-temp-deployment-folder --force fi - if git worktree list | grep -q '\[main\]'; then - echo "Removing existing main worktree" - git worktree remove $(git worktree list | grep '\[main\]' | awk '{print $1}') --force + # Check and remove any worktree associated with the deployment if it exists + if git worktree list | grep -q 'github-pages-deploy-action'; then + echo "Removing existing deployment worktree" + DEPLOYMENT_WORKTREE=$(git worktree list | grep 'github-pages-deploy-action' | awk '{print $1}') + git worktree remove "$DEPLOYMENT_WORKTREE" --force fi + - name: Download a Build Artifact Version uses: dawidd6/action-download-artifact@v2.26.1 with: