From 7a821fa3d646ec98e6c9be5e940a3d85d92dfcf8 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Tue, 13 Jun 2023 17:03:52 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20don=E2=80=99t=20block=20PR=20if=20matchi?= =?UTF-8?q?ng=20merged=20PR=20found=20(#22735)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/workers/repository/update/branch/handle-existing.ts | 2 -- lib/workers/repository/update/branch/index.spec.ts | 4 ++-- lib/workers/repository/update/branch/index.ts | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/workers/repository/update/branch/handle-existing.ts b/lib/workers/repository/update/branch/handle-existing.ts index aa99ace74a..bc7a79deb7 100644 --- a/lib/workers/repository/update/branch/handle-existing.ts +++ b/lib/workers/repository/update/branch/handle-existing.ts @@ -47,8 +47,6 @@ export async function handleClosedPr( await scm.deleteBranch(config.branchName); } } - } else if (pr.state === 'merged') { - logger.debug(`Merged PR with PrNo: ${pr.number} is blocking this branch`); } } diff --git a/lib/workers/repository/update/branch/index.spec.ts b/lib/workers/repository/update/branch/index.spec.ts index 4a438e2544..7ec2535e19 100644 --- a/lib/workers/repository/update/branch/index.spec.ts +++ b/lib/workers/repository/update/branch/index.spec.ts @@ -318,7 +318,7 @@ describe('workers/repository/update/branch/index', () => { expect(scm.deleteBranch).toHaveBeenCalledTimes(1); }); - it('skips branch if merged PR found', async () => { + it('allows branch even if merged PR found', async () => { const pr = partial<Pr>({ number: 13, state: 'merged', @@ -329,7 +329,7 @@ describe('workers/repository/update/branch/index', () => { await branchWorker.processBranch(config); expect(reuse.shouldReuseExistingBranch).toHaveBeenCalledTimes(0); expect(logger.debug).toHaveBeenCalledWith( - `Merged PR with PrNo: ${pr.number} is blocking this branch` + `Matching PR #${pr.number} was merged previously` ); }); diff --git a/lib/workers/repository/update/branch/index.ts b/lib/workers/repository/update/branch/index.ts index 003da47bb0..b66fd7850e 100644 --- a/lib/workers/repository/update/branch/index.ts +++ b/lib/workers/repository/update/branch/index.ts @@ -155,8 +155,7 @@ export async function processBranch( config.automerge = false; config.automergedPreviously = true; } - } - if (!branchPr && existingPr && !dependencyDashboardCheck) { + } else if (!branchPr && existingPr && !dependencyDashboardCheck) { logger.debug( { prTitle: config.prTitle }, 'Closed PR already exists. Skipping branch.' -- GitLab