action-slack-notify
action-slack-notify copied to clipboard
Overwriting SLACK_MESSAGE
I know the docs advise against doing this, but is there a way to do this at the moment with anything other than a plain text string? I would like to add a URL or interpolate another value such as an environment variable in this field if possible. In the case of passing a URL currently to SLACK_MESSAGE, the value output in slack is null.
Example: SLACK_MESSAGE: 'this is a test' Output on Slack: 'this is a test'
SLACK_MESSAGE: 'https://someurl.com' Output on Slack: null
Thanks!
There are two ways to send URL in a message on slack via the webhook, and both are working with this action.
-
Using the URL directly in the message:
SLACK_MESSAGE: 'https://someurl.com'Output on Slack: https://someurl.com -
Hyperlinking text with a url:
SLACK_MESSAGE: '<https://someurl.com|Some URL>'Output on Slack: Some URL
I test both of these and they are working as expected. So to debug the issue you are facing further, can you please share your workflow file?
Also, which version of the action are you using? If you are not using rtCamp/action-slack-notify@master or rtCamp/[email protected] I would advise you to use any one of these. Here @master always contains the latest stable version, which is v2.1.0 at the moment.
Hi @mrrobot47, I am currently using v2.1.0
Here is my config file, this is a standalone test I ran which when using your previous examples yielded the same output for me in Slack:
# The purpose of this workflow is for debugging actions/behavior of commands executed during steps
name: 'Debugging Workflow'
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
env:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
debug:
name: 'Debug Things'
runs-on: 'ubuntu-latest'
steps:
- name: 'Slack Notify'
uses: rtCamp/[email protected]
with:
SLACK_MESSAGE: 'https://someurl.com'
- name: 'Slack Notify'
uses: rtCamp/[email protected]
with:
SLACK_MESSAGE: '<https://someurl.com|Some URL>'
Here is a screenshot of the Slack output:

Also from that same run, the following error message was located in my CI output:
##[warning]Unexpected input(s) 'SLACK_MESSAGE', valid inputs are ['entryPoint', 'args']
I would also like to be able to use env vars for example
SLACK_MESSAGE: ':x: App ${BRANCH} failed tests'
Hi there,
In my side, I don't have the link on slack :
A new <https:github.com|release> is available
I would also like to be able to use env vars for example
SLACK_MESSAGE: ':x: App ${BRANCH} failed tests'
Unfortunately, this appear not to be supported. Basic functionalities that one would expect to see even in maiden release!