From eae9b4a347b894938efa9c002081e211492c0497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20P=C4=99dzich?= Date: Sun, 9 Oct 2022 15:02:17 +0200 Subject: [PATCH] Don't dismiss a review if all entries are valid --- bot.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/bot.ts b/bot.ts index bd486c0..f8abf9f 100644 --- a/bot.ts +++ b/bot.ts @@ -1,6 +1,8 @@ import { ApplicationFunction } from 'probot'; import getMetaData from 'metadata-scraper'; +type ReviewEvent = 'REQUEST_CHANGES' | 'COMMENT' | 'APPROVE'; + const bot: ApplicationFunction = (app) => { app.on( ['pull_request.opened', 'pull_request.synchronize'], @@ -22,8 +24,6 @@ const bot: ApplicationFunction = (app) => { const removePathFromFilename = (filename: string) => filename.replace(registryDirectoryPath, ''); - type ReviewEvent = 'REQUEST_CHANGES' | 'COMMENT' | 'APPROVE'; - const upsertReview = async ( review_id: number | undefined, body: string, @@ -34,6 +34,7 @@ const bot: ApplicationFunction = (app) => { ...workingRepo, pull_number, review_id, + event, body }); } else { @@ -161,19 +162,6 @@ const bot: ApplicationFunction = (app) => { .join('\n\n'); await upsertReview(existingReview?.id, reviewBody, reviewEvent); - - if ( - renameRequiredText === '' && - notFoundText === '' && - existingReview?.state === 'CHANGES_REQUESTED' - ) { - await context.octokit.pulls.dismissReview({ - ...workingRepo, - pull_number, - review_id: existingReview.id, - message: 'All new entries can be accepted!' - }); - } } catch (error) { console.error(error);