From ae1f7f974eb4b3ff71cf5500f894a39c835eaea7 Mon Sep 17 00:00:00 2001 From: Christophe Hurpeau Date: Sun, 22 Jan 2023 12:15:44 +0100 Subject: [PATCH] fix: disable reviewflow comment creation before callback --- src/events/pr-handlers/opened.test.ts | 4 ++++ src/events/pr-handlers/opened.ts | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/events/pr-handlers/opened.test.ts b/src/events/pr-handlers/opened.test.ts index 5327ee253..311761c20 100644 --- a/src/events/pr-handlers/opened.test.ts +++ b/src/events/pr-handlers/opened.test.ts @@ -39,6 +39,10 @@ describe('opened', (): void => { test('edits the pull request when pull request is opened', async (): Promise => { const scope = nock('https://api.github.com') + .get('/repos/reviewflow/reviewflow-test/issues/30/comments') + .times(1) + .reply(200, []) + .post( '/repos/reviewflow/reviewflow-test/issues/30/comments', '{"body":"This will be auto filled by reviewflow."}', diff --git a/src/events/pr-handlers/opened.ts b/src/events/pr-handlers/opened.ts index f4e756a0e..79d208414 100644 --- a/src/events/pr-handlers/opened.ts +++ b/src/events/pr-handlers/opened.ts @@ -6,11 +6,11 @@ import { autoAssignPRToCreator } from './actions/autoAssignPRToCreator'; import { editOpenedPR } from './actions/editOpenedPR'; import { updateReviewStatus } from './actions/updateReviewStatus'; import { updateStatusCheckFromStepsState } from './actions/updateStatusCheckFromStepsState'; -import { defaultCommentBody } from './actions/utils/body/updateBody'; +// import { defaultCommentBody } from './actions/utils/body/updateBody'; import { calcStepsState } from './actions/utils/steps/calcStepsState'; import { syncLabels } from './actions/utils/syncLabel'; import { createPullRequestHandler } from './utils/createPullRequestHandler'; -import { createReviewflowComment } from './utils/reviewflowComment'; +// import { createReviewflowComment } from './utils/reviewflowComment'; export default function opened(app: Probot, appContext: AppContext): void { createPullRequestHandler( @@ -86,12 +86,14 @@ export default function opened(app: Probot, appContext: AppContext): void { }), ]); }, - (pullRequest, context) => ({ - reviewflowCommentPromise: createReviewflowComment( - pullRequest.number, - context, - defaultCommentBody, - ), - }), + // https://sentry.io/organizations/chrp/issues/3888881569/?project=1243466&query=is%3Aunresolved&referrer=issue-stream + // https://github.com/christophehurpeau/reviewflow/pull/617 + // (pullRequest, context) => ({ + // reviewflowCommentPromise: createReviewflowComment( + // pullRequest.number, + // context, + // defaultCommentBody, + // ), + // }), ); }