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)
I am trying to add a link element 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
},
{
type: "link",
"text": "Something",
"url": "https://example.com",
"short": true
},
]
}
]
}
core.setOutput('payload', payload)
The message is composed and posted to slack all right but the specific block with the url is totally missing.
Any ideas?