slack-github-action
slack-github-action copied to clipboard
Body not formatted as markdown
When creating a release using the auto generated release notes, which is markdown. The body ${{ github.release.event.body }} is not being formatted as expected
Workflow
on:
release:
types:
- released
- prereleased
jobs:
notify:
runs-on: ubuntu-latest
steps:
- run: echo "${{ github.event.release.body || 'No release body provided' }}"
shell: bash
- run: |
echo "Release event detected: ${{ github.event_name }}"
echo "Release name: ${{ github.event.release.name || github.event.release.tag_name }}"
echo "Release body: ${{ github.event.release.body }}"
echo "Release URL: ${{ github.event.release.html_url }}"
echo "Release is a pre-release: ${{ github.event.release.prerelease }}"
echo "Workflow run ID: ${{ github.run_id }}"
echo "Repository: ${{ github.repository }}"
echo "Server URL: ${{ github.server_url }}"
- name: Send Slack Notification
uses: slackapi/[email protected]
with:
webhook-type: incoming-webhook
webhook: "${{ secrets.SLACK_WEBHOOK_URL }}"
payload: |
text: "🚀 🔖 ✨ Release notice ${{ github.event.release.name || github.event.release.tag_name }} ✨ 🔖 🚀"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*🚀 🔖 ✨ Release notice ${{ github.event.release.name || github.event.release.tag_name }} ✨ 🔖 🚀*"
- type: "context"
elements:
- type: "mrkdwn"
text: "*Build for*: ${{ github.event.release.prerelease && 'Stage' || 'Production' }}"
- type: "mrkdwn"
text: "*Version*: ${{ github.event.release.tag_name }}"
- type: "divider"
- type: "section"
text:
type: "mrkdwn"
text: "${{ github.event.release.body }}"
- type: "divider"
- type: "context"
elements:
- type: "mrkdwn"
text: "<${{ github.event.release.html_url }}|*Full Changelog*>"
- type: "mrkdwn"
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Workflow Run>"