From 512519db690d81a8eeb6178e40f61bccec6e9b14 Mon Sep 17 00:00:00 2001 From: Mentlegen <9807008+gentlementlegen@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:16:41 +0900 Subject: [PATCH] fix: no message is posted on skip --- src/run.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/run.ts b/src/run.ts index 2e6de60b..5d0c1a63 100644 --- a/src/run.ts +++ b/src/run.ts @@ -11,22 +11,20 @@ export async function run() { const { eventPayload, eventName } = program; if (eventName === "issues.closed") { if (eventPayload.issue.state_reason !== "completed") { - const result = logger.info("Issue was not closed as completed. Skipping."); - await githubCommentModuleInstance.postComment(result?.logMessage.diff || ""); - return result?.logMessage.raw; + return logger.info("Issue was not closed as completed. Skipping.").logMessage.raw; } const issue = parseGitHubUrl(eventPayload.issue.html_url); const activity = new IssueActivity(issue); await activity.init(); if (configuration.incentives.requirePriceLabel && !getSortedPrices(activity.self?.labels).length) { const result = logger.error("No price label has been set. Skipping permit generation."); - await githubCommentModuleInstance.postComment(result?.logMessage.diff || ""); - return result?.logMessage.raw; + await githubCommentModuleInstance.postComment(result.logMessage.diff); + return result.logMessage.raw; } const processor = new Processor(); await processor.run(activity); return processor.dump(); } else { - return logger.error(`${eventName} is not supported, skipping.`)?.logMessage.raw; + return logger.error(`${eventName} is not supported, skipping.`).logMessage.raw; } }