Skip to content

Commit 08c105c

Browse files
committed
prevent temp worktree accumulation
1 parent f7ffe9d commit 08c105c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,3 +483,14 @@ runs:
483483
if [[ -f "${WORKTREE_DIR}/${BRANCH}/report.html" ]]; then
484484
echo " - ${BRANCH}/report.html"
485485
fi
486+
487+
- name: Cleanup worktree
488+
if: ${{ always() }}
489+
shell: bash
490+
run: |
491+
set -euo pipefail
492+
if [[ -n "${WORKTREE_DIR:-}" ]]; then
493+
git worktree remove --force "$WORKTREE_DIR" >/dev/null 2>&1 || true
494+
rm -rf -- "$WORKTREE_DIR" || true
495+
fi
496+
git worktree prune || true

0 commit comments

Comments
 (0)