From 56e9a3973242e16d2fc18ceb567b3d29dd72495c Mon Sep 17 00:00:00 2001 From: BohuTANG Date: Thu, 23 Oct 2025 09:18:48 +0800 Subject: [PATCH 1/3] Remove translation init marker to avoid PR conflicts --- .github/workflows/docs-pr.translate.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/docs-pr.translate.yaml b/.github/workflows/docs-pr.translate.yaml index eea2a40647..cac86b4713 100644 --- a/.github/workflows/docs-pr.translate.yaml +++ b/.github/workflows/docs-pr.translate.yaml @@ -254,6 +254,25 @@ jobs: title: updatedTitle, body: updatedBody, }); + - name: Remove translation init marker + if: steps.branch.outputs.branch != '' + env: + TRANSLATION_BRANCH: ${{ steps.branch.outputs.branch }} + run: | + set -euo pipefail + git fetch origin "$TRANSLATION_BRANCH" + git checkout "$TRANSLATION_BRANCH" + + if [ -f ".translation-init" ]; then + git rm -f .translation-init + + if git status --porcelain | grep .; then + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git commit -m "chore: remove translation init marker" + git push origin "$TRANSLATION_BRANCH" + fi + fi - name: Apply deletions to translation branch if: > steps.collect.outputs.has_inputs == 'true' && From 470ae31f02c4c07c7dbebb7ef82ef1354ecb2454 Mon Sep 17 00:00:00 2001 From: BohuTANG Date: Thu, 23 Oct 2025 09:24:31 +0800 Subject: [PATCH 2/3] Consolidate translation branch cleanup step --- .github/workflows/docs-pr.translate.yaml | 57 ++++++++++-------------- 1 file changed, 24 insertions(+), 33 deletions(-) diff --git a/.github/workflows/docs-pr.translate.yaml b/.github/workflows/docs-pr.translate.yaml index cac86b4713..dc5c7f5133 100644 --- a/.github/workflows/docs-pr.translate.yaml +++ b/.github/workflows/docs-pr.translate.yaml @@ -190,6 +190,7 @@ jobs: SOURCE_PR: ${{ steps.pr.outputs.pr_number }} SOURCE_PR_URL: ${{ steps.pr.outputs.html_url }} REMOVED_FILES: ${{ steps.collect.outputs.removed_cn }} + TRANSLATION_BRANCH: ${{ steps.branch.outputs.branch }} with: script: | const branch = '${{ steps.branch.outputs.branch }}'; @@ -254,30 +255,8 @@ jobs: title: updatedTitle, body: updatedBody, }); - - name: Remove translation init marker + - name: Finalize translation branch if: steps.branch.outputs.branch != '' - env: - TRANSLATION_BRANCH: ${{ steps.branch.outputs.branch }} - run: | - set -euo pipefail - git fetch origin "$TRANSLATION_BRANCH" - git checkout "$TRANSLATION_BRANCH" - - if [ -f ".translation-init" ]; then - git rm -f .translation-init - - if git status --porcelain | grep .; then - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git commit -m "chore: remove translation init marker" - git push origin "$TRANSLATION_BRANCH" - fi - fi - - name: Apply deletions to translation branch - if: > - steps.collect.outputs.has_inputs == 'true' && - steps.collect.outputs.has_removals == 'true' && - steps.branch.outputs.branch != '' env: REMOVED_FILES: ${{ steps.collect.outputs.removed_cn }} TRANSLATION_BRANCH: ${{ steps.branch.outputs.branch }} @@ -290,23 +269,35 @@ jobs: sudo chown -R "$(id -u)":"$(id -g)" .git docs || true fi - for file in $REMOVED_FILES; do - if [ -f "$file" ]; then - rm -f "$file" - echo "Removed $file" - fi - done + changed=0 - find docs/cn -mindepth 1 -type d -empty -print -delete + if [ -f ".translation-init" ]; then + git rm -f .translation-init + echo "Removed .translation-init" + changed=1 + fi + + if [ -n "$REMOVED_FILES" ]; then + for file in $REMOVED_FILES; do + if [ -f "$file" ]; then + rm -f "$file" + echo "Removed $file" + changed=1 + fi + done + if [ -d docs/cn ]; then + find docs/cn -mindepth 1 -type d -empty -print -delete + fi + fi - if git status --porcelain | grep .; then + if [ "$changed" -eq 1 ]; then git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add -A - git commit -m "chore: sync deletions for PR #${{ steps.pr.outputs.pr_number }}" + git commit -m "chore: finalize translation for PR #${{ steps.pr.outputs.pr_number }}" git push origin "$TRANSLATION_BRANCH" else - echo "No deletions to commit." + echo "No cleanup changes to commit." fi - name: Prepare deletion-only changes From 9ef26c7ddf28838be8d9f8d4cdc1e5db1e513444 Mon Sep 17 00:00:00 2001 From: BohuTANG Date: Thu, 23 Oct 2025 09:28:59 +0800 Subject: [PATCH 3/3] Tidy translation workflow cleanup --- .github/workflows/docs-pr.translate.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docs-pr.translate.yaml b/.github/workflows/docs-pr.translate.yaml index dc5c7f5133..d5f6de6a72 100644 --- a/.github/workflows/docs-pr.translate.yaml +++ b/.github/workflows/docs-pr.translate.yaml @@ -190,7 +190,6 @@ jobs: SOURCE_PR: ${{ steps.pr.outputs.pr_number }} SOURCE_PR_URL: ${{ steps.pr.outputs.html_url }} REMOVED_FILES: ${{ steps.collect.outputs.removed_cn }} - TRANSLATION_BRANCH: ${{ steps.branch.outputs.branch }} with: script: | const branch = '${{ steps.branch.outputs.branch }}';