Skip to content

Commit 9039db6

Browse files
committed
Enhance Git worktree handling in documentation update workflow
- Improve pages branch checkout and update logic - Add explicit fetch and pull for the pages branch - Ensure robust handling of existing and new pages branches
1 parent bad5bcb commit 9039db6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/update_docs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@ jobs:
6161
# Create and switch to a new worktree for the pages branch
6262
git worktree add --detach pages
6363
cd pages
64+
65+
# Fetch and checkout pages branch, create if it doesn't exist
66+
git fetch origin pages || true
6467
git checkout pages || git checkout --orphan pages
6568
69+
# If the branch exists, pull latest changes
70+
if git rev-parse --verify origin/pages >/dev/null 2>&1; then
71+
git pull origin pages
72+
fi
73+
6674
# Remove existing files to prepare for new content
6775
git rm -rf . || true
6876

0 commit comments

Comments
 (0)