Skip to content

Commit 14e1f57

Browse files
committed
Don't fail on existing sync PRs
1 parent 6d130cf commit 14e1f57

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

scripts/sync-translations.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,22 @@ async function createPullRequest({
204204
auth: GITHUB_ACCESS_TOKEN,
205205
previews: ["hellcat-preview"],
206206
});
207-
await octokit.pulls.create({
208-
owner: GITHUB_ORG,
209-
repo: repoName,
210-
title,
211-
body,
212-
head: syncBranch,
213-
base: DEFAULT_BRANCH,
214-
});
207+
try {
208+
await octokit.pulls.create({
209+
owner: GITHUB_ORG,
210+
repo: repoName,
211+
title,
212+
body,
213+
head: syncBranch,
214+
base: DEFAULT_BRANCH,
215+
});
216+
} catch (e) {
217+
if (typeof e.message === 'string' && e.message.includes('already exists')) {
218+
// That's OK -- we already sent a PR for this hash.
219+
return;
220+
}
221+
throw e;
222+
}
215223
}
216224

217225
async function execRead(command, options) {

0 commit comments

Comments
 (0)