Merge branch 'test/incremental-fresh-2' - fix branch existence check

This commit is contained in:
Gu
2025-11-06 03:23:47 -08:00
6 changed files with 116 additions and 11 deletions

View File

@@ -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'

View File

@@ -30,6 +30,8 @@
{
"group": " ",
"pages": [
"en/test-fresh-incremental-first",
"en/test-fresh-incremental-second",
{
"group": "Getting Started",
"pages": [

View File

@@ -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: <SHA>`
## Next Step
After the translation PR is created, we'll push a **second file** to verify incremental updates work correctly.

View File

@@ -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: <SHA>`
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

View File

@@ -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: <SHA>`
## Next Step
After the translation PR is created, we'll push a **second file** to verify incremental updates work correctly.

View File

@@ -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: <SHA>`
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)