From 67d7862e664bebe05598f5559033944cb4fd2a0e Mon Sep 17 00:00:00 2001 From: David Sanders Date: Mon, 6 May 2024 14:14:26 -0700 Subject: [PATCH] fix: don't update backportable check with queued status --- src/index.ts | 12 +----------- src/operations/backport-to-location.ts | 18 ++++-------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/index.ts b/src/index.ts index 23aa110..c7ffcbf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -111,17 +111,7 @@ const probotHandler: ApplicationFunction = async (robot, { getRouter }) => { const targetBranch = labelToTargetBranch(label, PRStatus.TARGET); const runName = `${CHECK_PREFIX}${targetBranch}`; let checkRun = checkRuns.find((run) => run.name === runName); - if (checkRun) { - if (checkRun.conclusion !== 'neutral') continue; - - await context.octokit.checks.update( - context.repo({ - name: checkRun.name, - check_run_id: checkRun.id, - status: 'queued' as 'queued', - }), - ); - } else { + if (!checkRun) { const response = await context.octokit.checks.create( context.repo({ name: runName, diff --git a/src/operations/backport-to-location.ts b/src/operations/backport-to-location.ts index 7fda666..bdfdbfb 100644 --- a/src/operations/backport-to-location.ts +++ b/src/operations/backport-to-location.ts @@ -7,24 +7,14 @@ import { backportImpl } from '../utils'; import { Probot } from 'probot'; import { SimpleWebHookRepoContext, WebHookPR } from '../types'; -const createOrUpdateCheckRun = async ( +const getOrCreateCheckRun = async ( context: SimpleWebHookRepoContext, pr: WebHookPR, targetBranch: string, ) => { let check = await getCheckRun(context, pr, targetBranch); - if (check) { - if (check.conclusion === 'neutral') { - await context.octokit.checks.update( - context.repo({ - name: check.name, - check_run_id: check.id, - status: 'queued' as 'queued', - }), - ); - } - } else { + if (!check) { const response = await context.octokit.checks.create( context.repo({ name: `${CHECK_PREFIX}${targetBranch}`, @@ -78,7 +68,7 @@ export const backportToLabel = async ( return; } - const checkRun = await createOrUpdateCheckRun(context, pr, targetBranch); + const checkRun = await getOrCreateCheckRun(context, pr, targetBranch); const labelToRemove = label.name; const labelToAdd = label.name.replace(PRStatus.TARGET, PRStatus.IN_FLIGHT); @@ -113,7 +103,7 @@ export const backportToBranch = async ( `Executing backport to branch '${targetBranch}'`, ); - const checkRun = await createOrUpdateCheckRun(context, pr, targetBranch); + const checkRun = await getOrCreateCheckRun(context, pr, targetBranch); const labelToRemove = undefined; const labelToAdd = PRStatus.IN_FLIGHT + targetBranch;