Skip to content

Commit 6e57550

Browse files
Vx-VAndarist
andauthored
Do not pre-start github API request (#467)
* Do not pre-start github API request * Create quiet-jeans-poke.md --------- Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
1 parent 5f15b43 commit 6e57550

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

.changeset/quiet-jeans-poke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/action": patch
3+
---
4+
5+
Avoid searching for an existing pull request early.

src/run.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,6 @@ export async function runVersion({
300300
});
301301
}
302302

303-
const existingPullRequestsPromise = octokit.rest.pulls.list({
304-
...github.context.repo,
305-
state: "open",
306-
head: `${github.context.repo.owner}:${versionBranch}`,
307-
base: branch,
308-
});
309303
let changedPackages = await getChangedPackages(cwd, versionsByDirectory);
310304
let changedPackagesInfoPromises = Promise.all(
311305
changedPackages.map(async (pkg) => {
@@ -331,7 +325,12 @@ export async function runVersion({
331325

332326
await git.pushChanges({ branch: versionBranch, message: finalCommitMessage });
333327

334-
let existingPullRequests = await existingPullRequestsPromise;
328+
let existingPullRequests = await octokit.rest.pulls.list({
329+
...github.context.repo,
330+
state: "open",
331+
head: `${github.context.repo.owner}:${versionBranch}`,
332+
base: branch,
333+
});
335334
core.info(JSON.stringify(existingPullRequests.data, null, 2));
336335

337336
const changedPackagesInfo = (await changedPackagesInfoPromises)

0 commit comments

Comments
 (0)