From 7749541e5572f299d0e1eeb3c634dc468fc0a781 Mon Sep 17 00:00:00 2001 From: Soichiro Miki Date: Tue, 24 Jun 2025 13:30:24 +0900 Subject: [PATCH] Don't force-push sync branches --- scripts/sync-translations.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/sync-translations.js b/scripts/sync-translations.js index d27deebc..9b6955b1 100644 --- a/scripts/sync-translations.js +++ b/scripts/sync-translations.js @@ -304,9 +304,19 @@ async function syncContentWithUpstream(languageCode) { await exec(`git commit -am "merging all conflicts"`, options); } - // Create a new pull request, listing all conflicting files - await exec(`git push --set-upstream --force origin ${syncBranch}`, options); + try { + await exec(`git push --set-upstream origin ${syncBranch}`, options); + } catch (error) { + // If push fails, it is likely because the remote has been already + // updated by a human contributor. + console.log( + `Push to origin/${syncBranch} failed (likely due to remote updates by human contributors).\n` + + `Error: ${error.message}` + ); + return; + } + // Create a new pull request, listing all conflicting files const title = `Sync with ${MAIN_REPOSITORY_NAME} @ ${shortHash}`; let conflictsText = '';