diff --git a/.github/workflows/slack-notifications.yml b/.github/workflows/slack-notifications.yml index 41d0fc849..0e5ac3202 100644 --- a/.github/workflows/slack-notifications.yml +++ b/.github/workflows/slack-notifications.yml @@ -63,7 +63,9 @@ jobs: ] }') else - payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" --arg failures "${{ inputs.failures }}" '{ + # Escape the failures input for JSON and Slack + escaped_failures=$(echo "${{ inputs.failures }}" | jq -sRr @json | sed 's/\\n/\\n/g') + payload=$(jq -n --arg repository "${{ inputs.repository }}" --arg branch "${{ inputs.branch }}" --arg actor "${{ inputs.actor }}" --arg run_id "${{ inputs.run_id }}" --arg failures "$escaped_failures" '{ "channel": "team-gnark-build", "text": "GitHub Action build result: failure", "blocks": [ @@ -78,14 +80,14 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Failed Step:* " + "text": "" } }, { "type": "section", "text": { "type": "mrkdwn", - "text": "*Test Failure Details:* \($failures)" + "text": "*Failed tests:*\n\n\($failures)" } }, {