Fix: Force-push to existing sync branch erases human's work-in-progress #338
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the translation sync bot (
scripts/sync-translations.js) pushes to thesync-xxxxxxxbranch with the--forceoption:translations.react.dev/scripts/sync-translations.js
Line 308 in 7661529
However, when translation contributors have already started working on translation updates or conflict resolution on the same
sync-xxxxxxxbranch, a force-push from the script will overwrite their ongoing work in progress.Problem
The translation bot creates a sync branch named
sync-xxxxxxxbased on the most recent commit hash of the upstream (English)mainbranch. It then creates a corresponding sync PR. Currently, this happens every Monday. The sync branch contains conflict markers, and translators are expected to resolve them before merging it intomain.If there have been no updates to the upstream
mainsince the previous Monday, the script generates the samesync-xxxxxxxbranch and force-pushes it.If contributors have already started translation sync work (e.g., resolving conflicts, adding translations, making updates, requesting reviews, or discussing changes) on that
sync-xxxxxxxbranch, the script's force-push will erase their work.This problem doesn't surface when the upstream (English)
mainis updated at least once a week (between two Mondays), which is why I didn't notice it until recently.What Actually Happened
Currently, the English site's
mainbranch has remained at commit50d6991for a few weeks.main.Solution
There is no need to use the
--forceflag. Sync branches are where translators perform substantial manual work. If a branch with the same name already exists and its head hash is different, it indicates that a human translator has modified the sync branch. The bot must not touch it.@rickhanlonii Please take a look at this