Skip to content

Commit

Permalink
branch already exist handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangy10 committed Jun 25, 2024
1 parent 38bfacd commit f668928
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eng/copilot/testTranslation.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function syncPrChange() {

//prepare for github commit
const sha = await getLatestCommitSha(targetRepoOwner, targetRepo);
const changeSha = await createChangeBranch(targetRepoOwner, targetRepo, sha);
let changeSha = await createChangeBranch(targetRepoOwner, targetRepo, sha);

//stash files -> commit -> push
const blobs = await createBlob(targetRepoOwner, targetRepo, translatedFiles);
Expand All @@ -57,7 +57,11 @@ async function syncPrChange() {
await updateBranch(targetRepoOwner, targetRepo, commitSha);

//create pr
// await createPR(targetRepoOwner, targetRepo);
if (changeSha === sha) {
console.log("Branch already exists. Skipping PR creation.");
} else {
await createPR(targetRepoOwner, targetRepo);
}
}

async function translate(file, sessionId, accessToken, targetLanguage) {
Expand Down

0 comments on commit f668928

Please sign in to comment.