Skip to content

About

GitHub Action that posts a message to a Slack channel

Resources

Stars

0 stars

Watchers

0 watching

Forks

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slack Post GitHub Action

GitHub Action that posts a message to a Slack channel

Inputs

token

Optional The Slack auth token. This is only required if environment variable SLACK_BOT_TOKEN is not set.

channel

Required The channel name to post to (example: #general)

thread_ts

Optional The timestamp ID of the parent message to reply to (e.g., the ts output from a previous Slack message call)

text

Required The message text to post. See Slack's documentation on formatting.

Notes:

  • quotes, backticks, $(...) and $VAR in the text are posted literally, never executed or expanded
  • backslash escapes are interpreted the way bash's $'...' quoting does (e.g. \n becomes a newline and \' becomes '), so write \\ for a literal backslash. In a double-quoted YAML string, YAML removes one layer of escaping first, so double each backslash again (example: text: "C:\\\\temp, won\\'t" posts C:\temp, won't, the same as C:\\temp, won\'t in a | block scalar)
  • environment variables will only be expanded if referenced using the env GitHub Action context ${{ env.MY_VAR }} format (example: text: "This is the value of MY_VAR: ${{ env.MY_VAR }}")

unfurl_links

Optional Whether links in the message should be unfurled (default: true)

Requirements

The runner's bash must be version 4.4 or newer (GitHub-hosted runners are).

Outputs

ts

The timestamp ID of the message (can be used to make subsequent Slack messages a threaded reply)

error

The Slack API error code (e.g. channel_not_found, or ratelimited on an HTTP 429) when Slack rejected the message. The step fails in that case, so read this from a step with continue-on-error: true.

Example usage

- name: Post Slack message
  uses: ynab/slack-post-message-action@v1.6
  with:
    token: ${{ secrets.SLACK_API_TOKEN }}
    channel: "#general"
    text: ":tada: This is a test from the ${{ env.GITHUB_ACTION }} workflow! <https://github.com/ynab/slack-post-message-action|Action Documentation>"

About

GitHub Action that posts a message to a Slack channel

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors