Skip to content

Commit

Permalink
Update action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dcolina authored Aug 30, 2024
1 parent 47f8412 commit 1e092f3
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
with:
channel-id: ${{ inputs.channel-id }}
payload: ${{ env.payload }}
payload: ${{ steps.determine-payload.outputs.payload }}
env:
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}

0 comments on commit 1e092f3

Please sign in to comment.