mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
fix: slack message body (#59)
This commit is contained in:
parent
ed3ceaf5ad
commit
5ab5c1d0c1
2 changed files with 192 additions and 22 deletions
46
.github/workflows/slack-announcements.yml
vendored
46
.github/workflows/slack-announcements.yml
vendored
|
|
@ -22,29 +22,31 @@ jobs:
|
|||
echo "is_announcement=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
if: steps.check.outputs.is_announcement == 'true'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Prepare Slack Message
|
||||
if: steps.check.outputs.is_announcement == 'true'
|
||||
id: prepare_message
|
||||
run: |
|
||||
# Run the script with environment variables to avoid shell parsing issues
|
||||
PAYLOAD=$(./scripts/prepare-slack-message.sh)
|
||||
|
||||
# Set output for next step
|
||||
echo "slack_payload<<EOF" >> $GITHUB_OUTPUT
|
||||
echo "$PAYLOAD" >> $GITHUB_OUTPUT
|
||||
echo "EOF" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
DISCUSSION_TITLE: ${{ github.event.discussion.title }}
|
||||
DISCUSSION_BODY: ${{ github.event.discussion.body }}
|
||||
DISCUSSION_URL: ${{ github.event.discussion.html_url }}
|
||||
- name: Post to Slack
|
||||
if: steps.check.outputs.is_announcement == 'true'
|
||||
uses: slackapi/slack-github-action@v1
|
||||
uses: 8398a7/action-slack@v3
|
||||
with:
|
||||
payload: |
|
||||
{
|
||||
"text": "New Announcement: ${{ github.event.discussion.title }}",
|
||||
"blocks": [
|
||||
{
|
||||
"type": "section",
|
||||
"text": {
|
||||
"type": "mrkdwn",
|
||||
"text": "*${{ github.event.discussion.title }}*\n${{ github.event.discussion.body }}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "section",
|
||||
"text": {
|
||||
"type": "mrkdwn",
|
||||
"text": "<${{ github.event.discussion.html_url }}|View Discussion>"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
status: custom
|
||||
custom_payload: |
|
||||
${{ steps.prepare_message.outputs.slack_payload }}
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOGRAH_COMMUNITY_WEBHOOK_URL }}
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_DOGRAH_COMMUNITY_WEBHOOK_URL }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue