From 195b8b4f63be66f1ab3f08ebdc046ec88fbcf0ee Mon Sep 17 00:00:00 2001 From: Pavel Titenkov Date: Mon, 27 Nov 2023 22:43:33 +0100 Subject: [PATCH] defect: fail on empty webhook url --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 8f7a173..3fac54e 100644 --- a/index.js +++ b/index.js @@ -126,6 +126,11 @@ try { ? `>${commitMessage}\n>${links.commit} | By *${sender.name}* on \`${env.branch}\` | ${links.repository}` : `>By *${sender.name}* on \`${env.branch}\` | ${links.repository}` + if (!process.env.SLACK_WEBHOOK_URL) { + core.setFailed('Missing SLACK_WEBHOOK_URL environment variable') + return + } + const webhook = new IncomingWebhook(process.env.SLACK_WEBHOOK_URL) const message = { blocks: [