I am using this action to post a message to a slack channel through a Github Actions workflow.
I am constructing the payload
as follows
- name: set slack payload
uses: actions/github-script
with:
script: |
const payload = {
"text": "Some text",
"username": "Some username",
"icon_url": "https://www.ecample.com/icon.png",
"attachments": [
{
"mrkdwn_in": ["text"],
"color": "'#ffffff'",
"fields": [
{
"title": "A title",
"value": "some text",
"short": true
},
{
"title": "Mention",
"value": "<@username> hello",
"short": true
},
]
}
]
}
core.setOutput('payload', payload)
This works as expected and username
does indeed get mentioned.
However when I am substituting it with a slack user group, it does not get mentioned.
Any ideas?
You can't use the human-readable name for user group mentions, but need the ID. You can get that, for example, from the user group side panel:
and then use it like this:
"value": "<!subteam^ABCDEF12345> hello"