From 14a5181bb0c10f70bc8b4a42ccfdef442f773695 Mon Sep 17 00:00:00 2001 From: Raphael Eidus Date: Tue, 25 Oct 2022 11:12:17 -0700 Subject: [PATCH] feat: allow custom message text --- README.md | 4 ++++ action.yml | 3 +++ dist/index.js | 2 ++ index.js | 2 ++ 4 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 7c8f638f..cb4387a7 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,10 @@ The ID of the channel to post the message to. **Required** if no `channel` is pr The color to use for the notification. Can be a hex value or any [valid Slack color level](https://api.slack.com/reference/messaging/attachments#fields) (e.g. `good`). Defaults to `#cccccc`. +### `message_text` + +Optional freeform text to be included with the status + ### `message_id` The ID of a previous Slack message to update instead of posting a new message. Typically passed using the `steps` context: diff --git a/action.yml b/action.yml index 78031ff7..471808c7 100644 --- a/action.yml +++ b/action.yml @@ -20,6 +20,9 @@ inputs: message_id: description: 'The ID of the existing Slack message to update.' required: false + message_text: + description: 'Optional message text' + required: false outputs: message_id: description: 'The unique timestamp identifier of the Slack message sent' diff --git a/dist/index.js b/dist/index.js index bb42a213..830c742d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1072,6 +1072,7 @@ const { buildSlackAttachments, formatChannelName } = __webpack_require__(543); const status = core.getInput('status'); const color = core.getInput('color'); const messageId = core.getInput('message_id'); + const messageText = core.getInput('message_text'); const token = process.env.SLACK_BOT_TOKEN; const slack = new WebClient(token); @@ -1092,6 +1093,7 @@ const { buildSlackAttachments, formatChannelName } = __webpack_require__(543); const args = { channel: channelId, + text: messageText || undefined, attachments, }; diff --git a/index.js b/index.js index 4ad149c0..fb541d2a 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,7 @@ const { buildSlackAttachments, formatChannelName } = require('./src/utils'); const status = core.getInput('status'); const color = core.getInput('color'); const messageId = core.getInput('message_id'); + const messageText = core.getInput('message_text'); const token = process.env.SLACK_BOT_TOKEN; const slack = new WebClient(token); @@ -29,6 +30,7 @@ const { buildSlackAttachments, formatChannelName } = require('./src/utils'); const args = { channel: channelId, + text: messageText || undefined, attachments, };