diff --git a/.github/actions/core-cicd/notification/notify-slack/action.yml b/.github/actions/core-cicd/notification/notify-slack/action.yml index a78444a0c3b0..39be441e70dc 100644 --- a/.github/actions/core-cicd/notification/notify-slack/action.yml +++ b/.github/actions/core-cicd/notification/notify-slack/action.yml @@ -19,20 +19,23 @@ runs: using: "composite" steps: - name: Determine Payload + id: determine-payload run: | if [ "${{ inputs.json }}" == "true" ]; then # Use the payload directly, assuming it is already a valid JSON object - echo "payload=${{ inputs.payload }}" >> $GITHUB_ENV + payload=${{ inputs.payload }} + echo "Payload: $payload" else # Wrap the message in a default JSON structure using toJSON - echo "payload=$(echo '{}' | jq --arg msg ${{ toJSON(inputs.payload) }} '.blocks = [{"type": "section", "text": {"type": "mrkdwn", "text": $msg}}]')" >> $GITHUB_ENV + payload=$(echo '{}' | jq --arg msg ${{ toJSON(inputs.payload) }} '.blocks = [{"type": "section", "text": {"type": "mrkdwn", "text": $msg}}]') fi + echo "payload=$payload" >> $GITHUB_OUTPUT shell: bash - name: Slack Notification uses: slackapi/slack-github-action@v1.26.0 with: channel-id: ${{ inputs.channel-id }} - payload: ${{ env.payload }} + payload: ${{ steps.determine-payload.outputs.payload }} env: SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}