From 6e575506e63f9e69e475d3eccfdd61b448efc8ae Mon Sep 17 00:00:00 2001 From: Vx-V <207031497+Vx-V@users.noreply.github.com> Date: Wed, 7 May 2025 00:07:15 +0300 Subject: [PATCH] Do not pre-start github API request (#467) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Do not pre-start github API request * Create quiet-jeans-poke.md --------- Co-authored-by: Mateusz BurzyƄski --- .changeset/quiet-jeans-poke.md | 5 +++++ src/run.ts | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .changeset/quiet-jeans-poke.md diff --git a/.changeset/quiet-jeans-poke.md b/.changeset/quiet-jeans-poke.md new file mode 100644 index 0000000..a2a446e --- /dev/null +++ b/.changeset/quiet-jeans-poke.md @@ -0,0 +1,5 @@ +--- +"@changesets/action": patch +--- + +Avoid searching for an existing pull request early. diff --git a/src/run.ts b/src/run.ts index 5ef5735..a7ad64a 100644 --- a/src/run.ts +++ b/src/run.ts @@ -300,12 +300,6 @@ export async function runVersion({ }); } - const existingPullRequestsPromise = octokit.rest.pulls.list({ - ...github.context.repo, - state: "open", - head: `${github.context.repo.owner}:${versionBranch}`, - base: branch, - }); let changedPackages = await getChangedPackages(cwd, versionsByDirectory); let changedPackagesInfoPromises = Promise.all( changedPackages.map(async (pkg) => { @@ -331,7 +325,12 @@ export async function runVersion({ await git.pushChanges({ branch: versionBranch, message: finalCommitMessage }); - let existingPullRequests = await existingPullRequestsPromise; + let existingPullRequests = await octokit.rest.pulls.list({ + ...github.context.repo, + state: "open", + head: `${github.context.repo.owner}:${versionBranch}`, + base: branch, + }); core.info(JSON.stringify(existingPullRequests.data, null, 2)); const changedPackagesInfo = (await changedPackagesInfoPromises)