From 57d81acc60e3b60eab899e2571050f003704fcbc Mon Sep 17 00:00:00 2001 From: Brad Herrmann Date: Tue, 9 Jul 2024 11:26:02 -0500 Subject: [PATCH] remove successful and stale PRs --- src/helpers/remove-pr-from-merge-queue.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/remove-pr-from-merge-queue.ts b/src/helpers/remove-pr-from-merge-queue.ts index 75384614..3cefdcda 100644 --- a/src/helpers/remove-pr-from-merge-queue.ts +++ b/src/helpers/remove-pr-from-merge-queue.ts @@ -54,8 +54,8 @@ export const removePrFromMergeQueue = async ({ seconds }: RemovePrFromMergeQueue ref: sha, ...context.repo }); - const failingStatus = data.find(status => status.state === 'failure'); - if (failingStatus && timestampIsStale(failingStatus.created_at, seconds)) { + const status = data.find(status => status.state === 'failure' || status.state === 'success'); + if (status && timestampIsStale(status.created_at, seconds)) { core.info('Removing stale PR from first queued position...'); return Promise.all([removeLabelIfExists(READY_FOR_MERGE_PR_LABEL, number), removeLabelIfExists(FIRST_QUEUED_PR_LABEL, number)]); }