-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41d5a0a
commit 0158c13
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ or | |
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
``` | ||
or | ||
> If the `payload` is provided it will take preference over `payload-file-path` | ||
|
@@ -211,6 +212,37 @@ Please note that **the message update step does not accept a channel name.** Set | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
``` | ||
|
||
#### Reply to a message | ||
|
||
If you want to post a message as a reply, you can populate the `payload` with a `"thread_ts"` field. The steps after the first message posting can have `"thread_ts": "${{ steps.slack.outputs.ts }}"` in their payload. In order to reply to an existing message. | ||
Please note that **that reply to a message does not accept a channel name.** Set a channel ID for the actions that reply to messages in thread. | ||
```yaml | ||
- id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: "CHANNEL_ID" | ||
payload: | | ||
{ | ||
"text": "Deployment started (In Progress)" | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
- uses: slackapi/[email protected] | ||
with: | ||
# Unlike the step posting a new message, this step does not accept a channel name. | ||
# Please use a channel ID, not a name here. | ||
channel-id: "CHANNEL_ID" | ||
payload: | | ||
{ | ||
"thread_ts": "${{ steps.slack.outputs.ts }}" | ||
"text": "Deployment finished (Completed)", | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
``` | ||
### Technique 3: Slack Incoming Webhook | ||
This approach allows your GitHub Actions job to post a message to a Slack channel or direct message by utilizing [Incoming Webhooks](https://api.slack.com/messaging/webhooks). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters