Skip to content

Commit 8cfcb13

Browse files
committed
fix: prevention to remove the git repo
Signed-off-by: Abinand P <abinand0911@gmail.com>
1 parent 23bc739 commit 8cfcb13

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/publish-pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ jobs:
9292
git clean -fd
9393
git fetch origin gh-pages
9494
git checkout gh-pages
95-
# Clean all existing content
96-
git rm -rf . 2>/dev/null || true
97-
rm -rf * .* 2>/dev/null || true
95+
# Clean all existing content (but preserve .git)
96+
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} + 2>/dev/null || true
9897
else
9998
echo "gh-pages branch doesn't exist, creating orphan branch..."
10099
git checkout --orphan gh-pages
101100
git rm -rf . 2>/dev/null || true
102-
rm -rf * .* 2>/dev/null || true
101+
# Clean all existing content (but preserve .git)
102+
find . -maxdepth 1 ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} + 2>/dev/null || true
103103
fi
104104
105105
# Copy generated site files from safe location

0 commit comments

Comments
 (0)