Fix/allow stale branch auto sync (#556)

* 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 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Chenhe Gu
2025-11-27 21:36:24 +09:00
committed by GitHub
parent a91884f81d
commit 7c11027d80

View File

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