The following configuration (indented for readability) returns the invalid_blocks
error. However, it works in the Block Kit Builder.
- name: Notify
run: >-
curl -X POST "${{ secrets.WEBHOOK }}" -H "Content-Type: application/json" --data
'{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "New configs were successfully built and uploaded",
"emoji": true
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.CONFIGS }}"
}
}
]
}'
The configs are the STDOUT
from a docker run command earlier in the workflow.
I have a working legacy configuration.
- name: Notify
run: >-
curl -X POST "${{ secrets.WEBHOOK }}" -H "Content-Type: application/json" --data
'{"attachments":[
{ "mrkdwn_in":["text"],
"pretext":"New configs were successfully built and uploaded",
"text":"${{ env.CONFIGS }}",
"color":"good"}]}'
I don't understand why it wouldn't work. Other solutions I've seen involve sending the json payload as a referenced external file, which I don't think would work here. My guess is that there's something about Github Actions that doesn't work well with the Slack API Layout Blocks, which is recommended over the legacy Secondary Attachments format. Anyone else encountering this issue?