From 7c11027d807bf24d0acc3ee78a3895ed060adbf6 Mon Sep 17 00:00:00 2001 From: Chenhe Gu Date: Thu, 27 Nov 2025 21:36:24 +0900 Subject: [PATCH] Fix/allow stale branch auto sync (#556) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix redirect language code prefixes * fix: Allow stale branches to trigger auto-sync without false mixed-content errors Changes the PR analysis to use merge-base instead of PR base commit for comparison. This allows stale branches to trigger translation automation without being falsely flagged as "mixed content" PRs. **Problem:** - When a PR branch becomes stale (main moves forward after branch creation) - Old approach compared PR_BASE (main's current HEAD) vs PR_HEAD - This included unrelated changes from main as "part of the PR" - Caused false "mixed content" errors (e.g., PR #555) **Solution:** - Use merge-base to find where branch diverged from main - Compare MERGE_BASE vs PR_HEAD (only actual PR changes) - Ignore unrelated changes that landed on main after branch creation **Benefits:** - ✅ Better contributor experience (no manual branch updates needed) - ✅ Accurate PR categorization (no false positives) - ✅ Faster automation (no waiting for updates) - ✅ Works with concurrent PRs **Example (PR #555):** - OLD: Detected 4 files (en + cn + jp) → "mixed content" ❌ - NEW: Detected 1 file (en only) → "english" ✅ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --------- Co-authored-by: Claude --- .github/workflows/sync_docs_analyze.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync_docs_analyze.yml b/.github/workflows/sync_docs_analyze.yml index 30fc5e87..1bec5e70 100644 --- a/.github/workflows/sync_docs_analyze.yml +++ b/.github/workflows/sync_docs_analyze.yml @@ -94,7 +94,13 @@ jobs: else echo "🆕 New PR event - analyzing full changes" - COMPARE_BASE="$PR_BASE" + + # Use merge-base to find where branch diverged from main + # This allows stale branches to trigger automation without false "mixed content" errors + MERGE_BASE=$(git merge-base "$PR_BASE" "$PR_HEAD") + echo "Branch diverged from main at: $MERGE_BASE" + + COMPARE_BASE="$MERGE_BASE" COMPARE_HEAD="$PR_HEAD" IS_INCREMENTAL="false" fi