From e1c4115f1a813079e3023be6685adb084450c5e0 Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 6 Nov 2025 02:32:32 -0800 Subject: [PATCH 1/6] test: add first file for fresh incremental translation test --- docs.json | 1 + en/test-incremental-first.md | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 en/test-incremental-first.md diff --git a/docs.json b/docs.json index 07579100..b3c7a6be 100644 --- a/docs.json +++ b/docs.json @@ -30,6 +30,7 @@ { "group": " ", "pages": [ + "en/test-incremental-first", { "group": "Getting Started", "pages": [ diff --git a/en/test-incremental-first.md b/en/test-incremental-first.md new file mode 100644 index 00000000..34e04900 --- /dev/null +++ b/en/test-incremental-first.md @@ -0,0 +1,19 @@ +--- +title: Incremental Test - First File +description: Testing incremental translation workflow with the first file +--- + +# Incremental Translation - First File + +This is the **first file** in our incremental translation test. + +## Expected Behavior + +When this PR is created: +1. Translation PR should be created +2. This file should be translated to `cn/` and `jp/` +3. Commit message should include `Last-Processed-Commit: ` + +## Next Step + +After the translation PR is created, we'll push a **second file** to verify incremental updates work correctly. From 632ab5251b45a8a389dadcf55a8ea328b80f20c0 Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 6 Nov 2025 02:34:31 -0800 Subject: [PATCH 2/6] trigger: re-run workflows with branch fix From 2cfae59bb06c9cb1c9ba470628f5fc8139ad2405 Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 6 Nov 2025 02:37:35 -0800 Subject: [PATCH 3/6] test: add second file to verify end-to-end workflow --- docs.json | 1 + en/test-incremental-second.md | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 en/test-incremental-second.md diff --git a/docs.json b/docs.json index b3c7a6be..0872721f 100644 --- a/docs.json +++ b/docs.json @@ -31,6 +31,7 @@ "group": " ", "pages": [ "en/test-incremental-first", + "en/test-incremental-second", { "group": "Getting Started", "pages": [ diff --git a/en/test-incremental-second.md b/en/test-incremental-second.md new file mode 100644 index 00000000..df307a32 --- /dev/null +++ b/en/test-incremental-second.md @@ -0,0 +1,22 @@ +--- +title: Incremental Test - Second File +description: Testing incremental translation workflow with the second file +--- + +# Incremental Translation - Second File + +This is the **second file** in our incremental translation test. + +## Expected Behavior + +When this commit is pushed: +1. Translation PR should be **updated** (not force-pushed) +2. Translation PR should have **2 commits total** +3. Second commit message should include the new `Last-Processed-Commit: ` +4. Only this file should be translated (first file should NOT be re-translated) + +## Success Criteria + +✅ Translation PR has 2 commits (not 1) +✅ Both commits have different SHAs +✅ Git history is preserved (no force-push) From a148119a3fb602020a2b0640cea677731c5f43c0 Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 6 Nov 2025 03:16:25 -0800 Subject: [PATCH 4/6] test: add first file for fresh incremental translation test This commit adds the first test file to verify the incremental translation workflow with the English file removal fix applied. Expected: Translation PR should contain only cn/, jp/ files and docs.json. --- docs.json | 3 +-- en/test-fresh-incremental-first.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 en/test-fresh-incremental-first.md diff --git a/docs.json b/docs.json index 0872721f..8ee24adc 100644 --- a/docs.json +++ b/docs.json @@ -30,8 +30,7 @@ { "group": " ", "pages": [ - "en/test-incremental-first", - "en/test-incremental-second", + "en/test-fresh-incremental-first", { "group": "Getting Started", "pages": [ diff --git a/en/test-fresh-incremental-first.md b/en/test-fresh-incremental-first.md new file mode 100644 index 00000000..2ffb82d7 --- /dev/null +++ b/en/test-fresh-incremental-first.md @@ -0,0 +1,24 @@ +--- +title: Fresh Incremental Test - First File +description: Testing incremental translation with fixed workflow - first file +--- + +# Fresh Incremental Translation Test - First File + +This is the **first file** in our fresh incremental translation test with the English file removal fix. + +## Expected Behavior + +When this PR is created: +1. Translation PR should be created +2. This file should be translated to `cn/` and `jp/` +3. Translation commit should ONLY contain: + - `cn/test-fresh-incremental-first.md` + - `jp/test-fresh-incremental-first.md` + - `docs.json` +4. Translation commit should NOT contain any `en/` files +5. Commit message should include `Last-Processed-Commit: ` + +## Next Step + +After the translation PR is created, we'll push a **second file** to verify incremental updates work correctly. From 13247986064dceb4e9d42023bc9e37015182f9cb Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 6 Nov 2025 03:20:36 -0800 Subject: [PATCH 5/6] test: add second file to verify incremental translation This commit adds the second test file to verify that: 1. Translation PR is updated (not force-pushed) 2. Only new file is translated (first file not re-translated) 3. No English source files leak into translation commits Expected: Translation PR should have 2 commits with clean git history. --- docs.json | 1 + en/test-fresh-incremental-second.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 en/test-fresh-incremental-second.md diff --git a/docs.json b/docs.json index 8ee24adc..e6f6559b 100644 --- a/docs.json +++ b/docs.json @@ -31,6 +31,7 @@ "group": " ", "pages": [ "en/test-fresh-incremental-first", + "en/test-fresh-incremental-second", { "group": "Getting Started", "pages": [ diff --git a/en/test-fresh-incremental-second.md b/en/test-fresh-incremental-second.md new file mode 100644 index 00000000..f401d40d --- /dev/null +++ b/en/test-fresh-incremental-second.md @@ -0,0 +1,28 @@ +--- +title: Fresh Incremental Test - Second File +description: Testing incremental translation with fixed workflow - second file +--- + +# Fresh Incremental Translation Test - Second File + +This is the **second file** in our fresh incremental translation test. + +## Expected Behavior + +When this commit is pushed: +1. Translation PR #86 should be **updated** (not force-pushed) +2. Translation PR should have **2 commits total** +3. Second commit should include new `Last-Processed-Commit: ` +4. Second commit should ONLY contain: + - `cn/test-fresh-incremental-second.md` + - `jp/test-fresh-incremental-second.md` + - `docs.json` (if navigation changed) +5. Second commit should NOT contain any `en/` files +6. First file should NOT be re-translated + +## Success Criteria + +✅ Translation PR has 2 commits (not 1) +✅ Both commits have different SHAs +✅ Git history is preserved (no force-push) +✅ No English source files in any commit From 84703cace28b8c761d2873709b30c46f67978308 Mon Sep 17 00:00:00 2001 From: Gu Date: Thu, 6 Nov 2025 03:23:20 -0800 Subject: [PATCH 6/6] fix: use GitHub API to check branch existence --- .github/workflows/sync_docs_execute.yml | 32 ++++++++++++++++--------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/sync_docs_execute.yml b/.github/workflows/sync_docs_execute.yml index ed0dcf2a..746174f8 100644 --- a/.github/workflows/sync_docs_execute.yml +++ b/.github/workflows/sync_docs_execute.yml @@ -203,18 +203,28 @@ jobs: - name: Check if translation branch exists if: steps.extract-artifacts.outputs.sync_required == 'true' id: check-branch - run: | - PR_NUMBER="${{ steps.extract-artifacts.outputs.pr_number }}" - SYNC_BRANCH="docs-sync-pr-${PR_NUMBER}" + uses: actions/github-script@v7 + with: + script: | + const prNumber = '${{ steps.extract-artifacts.outputs.pr_number }}'; + const branchName = `docs-sync-pr-${prNumber}`; - # Check if translation branch exists on remote - if git ls-remote --exit-code --heads origin "$SYNC_BRANCH" >/dev/null 2>&1; then - echo "✅ Translation branch exists: $SYNC_BRANCH" - echo "branch_exists=true" >> $GITHUB_OUTPUT - else - echo "🆕 Translation branch does not exist yet" - echo "branch_exists=false" >> $GITHUB_OUTPUT - fi + try { + await github.rest.repos.getBranch({ + owner: context.repo.owner, + repo: context.repo.repo, + branch: branchName + }); + console.log(`✅ Translation branch exists: ${branchName}`); + core.setOutput('branch_exists', 'true'); + } catch (error) { + if (error.status === 404) { + console.log(`🆕 Translation branch does not exist yet`); + core.setOutput('branch_exists', 'false'); + } else { + throw error; + } + } - name: Checkout PR branch if: steps.extract-artifacts.outputs.sync_required == 'true'