Skip to content

Commit b72ccdb

Browse files
committed
fix: Also configure remote URL when updating existing clone
- Ensures authentication is set up for both new clones and updates
1 parent 626e0e5 commit b72ccdb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

scripts/publish-docc-to-github-pages.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ fi
109109
if [ -d "$CLONE_DIR" ] && [ -d "$CLONE_DIR/.git" ]; then
110110
echo "Updating existing clone..."
111111
cd "$CLONE_DIR"
112+
# Configure remote URL with token for pushing (if in GitHub Actions)
113+
if [ -n "$GITHUB_ACTIONS" ] && [ -n "$GITHUB_TOKEN" ]; then
114+
git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_USER}/${GITHUB_PAGES_REPO}.git"
115+
fi
112116
# Try master first (common for older repos), then main
113117
git pull origin master 2>/dev/null || git pull origin main 2>/dev/null || true
114118
else

0 commit comments

Comments
 (0)