From ac266070b2fede0ca6dd557b13f539c944a5a50f Mon Sep 17 00:00:00 2001 From: doug <4741454+douglance@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:02:38 -0400 Subject: [PATCH] chore: improves create PR error handling (#1987) --- packages/scripts/src/addOrbitChain/transforms.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/scripts/src/addOrbitChain/transforms.ts b/packages/scripts/src/addOrbitChain/transforms.ts index 7584d7d35a..e34dbf45a2 100644 --- a/packages/scripts/src/addOrbitChain/transforms.ts +++ b/packages/scripts/src/addOrbitChain/transforms.ts @@ -165,8 +165,17 @@ export const commitChangesAndCreatePR = async ( console.log("Changes committed successfully"); const issue = await getIssue(process.env.ISSUE_NUMBER!); console.log("Creating pull request..."); - await createPullRequest(branchName, orbitChain.name, issue.html_url); - console.log("Pull request created successfully"); + await createPullRequest(branchName, orbitChain.name, issue.html_url) + .catch((err) => { + if (err.message.includes("A pull request already exists")) { + console.log("Pull request already exists."); + } else { + throw err; + } + }) + .then(() => { + console.log("Pull request created successfully"); + }); core.endGroup(); };