Fix Slack notification payload formatting

- Write JSON to file to avoid shell escaping issues
- Use --data-binary with file reference for proper JSON transmission
- Removes double-stringification problem
This commit is contained in:
Peter Steinberger 2025-06-23 17:15:11 +02:00
parent 2af9257562
commit ff3145f282

View file

@ -105,7 +105,10 @@ jobs:
}]
};
core.setOutput('message', message);
// Write message to file to avoid shell escaping issues
const fs = require('fs');
fs.writeFileSync('/tmp/slack-message.json', JSON.stringify(message));
return message;
- name: Send to Slack
@ -113,8 +116,7 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
echo '${{ toJson(steps.slack-message.outputs.message) }}' | \
curl -X POST \
-H 'Content-type: application/json' \
--data @- \
--data-binary @/tmp/slack-message.json \
"$SLACK_WEBHOOK_URL"