From 6f8399fed29a8058f66d781b4e63069efc428b96 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:29:45 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20rclone=20OAuth2=20token=20JSON=20?= =?UTF-8?q?=E2=80=94=20use=20Node.js=20instead=20of=20shell=20echo=20to=20?= =?UTF-8?q?avoid=20escaping=20issues=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/5987057e-c76e-4db1-b9a5-849a9c70cb4e --- .github/workflows/sync-repo-to-drive.yml | 29 ++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sync-repo-to-drive.yml b/.github/workflows/sync-repo-to-drive.yml index 509aa8bd..9609eaf0 100644 --- a/.github/workflows/sync-repo-to-drive.yml +++ b/.github/workflows/sync-repo-to-drive.yml @@ -49,16 +49,27 @@ jobs: echo "✅ OAuth2 credentials validated" + # Use node to generate token JSON — avoids shell escaping issues with special characters + TOKEN_JSON=$(node -e " + const token = { + access_token: '', + token_type: 'Bearer', + refresh_token: process.env.GDRIVE_REFRESH_TOKEN, + expiry: '2000-01-01T00:00:00Z' + }; + process.stdout.write(JSON.stringify(token)); + ") + mkdir -p "${HOME}/.config/rclone" - { - echo "[gdrive]" - echo "type = drive" - echo "scope = drive" - echo "client_id = ${GDRIVE_CLIENT_ID}" - echo "client_secret = ${GDRIVE_CLIENT_SECRET}" - echo "token = {\"access_token\":\"\",\"token_type\":\"Bearer\",\"refresh_token\":\"${GDRIVE_REFRESH_TOKEN}\",\"expiry\":\"2000-01-01T00:00:00Z\"}" - echo "root_folder_id = 1fqWdLPaZkUZYt4OT_h3fJQHnd-q5QN3G" - } > "${HOME}/.config/rclone/rclone.conf" + cat > "${HOME}/.config/rclone/rclone.conf" <