Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow custom message text #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 2 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -1092,6 +1093,7 @@ const { buildSlackAttachments, formatChannelName } = __webpack_require__(543);

const args = {
channel: channelId,
text: messageText || undefined,
attachments,
};

Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -29,6 +30,7 @@ const { buildSlackAttachments, formatChannelName } = require('./src/utils');

const args = {
channel: channelId,
text: messageText || undefined,
attachments,
};

Expand Down