diff --git a/src/domain/github.ts b/src/domain/github.ts index 1d028b6..c94e083 100644 --- a/src/domain/github.ts +++ b/src/domain/github.ts @@ -33,6 +33,14 @@ const buildError = (payload: unknown): Error => { return new Error(`unknown event hook: ${JSON.stringify(payload)}`); }; +export const needToReviewRequest = (payload: WebhookPayload): boolean => { + if (payload.pull_request?.draft === true) { + return false; + } + + return true; +}; + export const needToSendApproveMention = (payload: WebhookPayload): boolean => { if (payload.review?.state === "approved") { return true; diff --git a/src/main.ts b/src/main.ts index 6798c3d..9304e0d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -10,7 +10,11 @@ import { postError, } from "./usecase"; import { getAllInputs } from "./model"; -import { needToMention, needToSendApproveMention } from "./domain/github"; +import { + needToMention, + needToReviewRequest, + needToSendApproveMention, +} from "./domain/github"; export const main = async (): Promise => { core.info("start main"); @@ -27,7 +31,7 @@ export const main = async (): Promise => { const mapping = await execLoadMapping(configurationPath, repoToken); core.info(JSON.stringify(mapping)); - if (reviewRequest) { + if (reviewRequest && needToReviewRequest(payload)) { await execPrReviewRequestedMention(payload, allInputs, mapping); core.info("finish execPrReviewRequestedMention()"); } else if (needToSendApproveMention(payload)) {