From ff3145f2827c50902f7cd4fbcd55c6ec7a0fe7f5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 23 Jun 2025 17:15:11 +0200 Subject: [PATCH] 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 --- .github/workflows/slack-notify.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/slack-notify.yml b/.github/workflows/slack-notify.yml index f66adfc3..ccf364e3 100644 --- a/.github/workflows/slack-notify.yml +++ b/.github/workflows/slack-notify.yml @@ -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" \ No newline at end of file