validate payload and pass to message

This commit is contained in:
Randy Brown
2021-11-09 12:33:00 +02:00
committed by Mantas
parent 2da2a2675b
commit 896f3a6ff0
+2 -2
View File
@@ -28,9 +28,9 @@ try {
const channelId = core.getInput('channel-id');
const web = new WebClient(botToken);
if (channelId.length > 0 && message.length > 0) {
if (channelId.length > 0 && (message.length > 0 || payload)) {
// post message
web.chat.postMessage({ text: message, channel: channelId });
web.chat.postMessage({ channel: channelId, text: message, ...(payload ?? {}) });
} else {
console.log('missing either channel-id, slack-message or payload! Did not send a message via chat.postMessage with botToken');
}