Skip to content

Commit

Permalink
Merge pull request #4998 from adamkpickering/wrap-github-api-request-…
Browse files Browse the repository at this point in the history
…in-try-catch

Wrap github pull request creation API call in try-catch
  • Loading branch information
jandubois authored Jun 21, 2023
2 parents a068c81 + 0ca9e45 commit b7f7b5f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions scripts/rddepman.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,18 @@ async function createDependencyBumpPR(name: string, currentVersion: string | Alp
const branchName = getBranchName(name, currentVersion, latestVersion);

console.log(`Creating PR "${ title }".`);
await getOctokit().rest.pulls.create({
owner: GITHUB_OWNER,
repo: GITHUB_REPO,
title,
base: MAIN_BRANCH,
head: branchName,
});
try {
await getOctokit().rest.pulls.create({
owner: GITHUB_OWNER,
repo: GITHUB_REPO,
title,
base: MAIN_BRANCH,
head: branchName,
});
} catch (err: any) {
console.log(JSON.stringify(err.response?.data));
throw err;
}
}

type PRSearchFn = ReturnType<Octokit['rest']['search']['issuesAndPullRequests']>;
Expand Down

0 comments on commit b7f7b5f

Please sign in to comment.