Skip to content

Commit

Permalink
Update discord_notify.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
afreakyelf authored Apr 2, 2024
1 parent d64b8c6 commit 217ab74
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/discord_notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ on:
types: [created]

jobs:
discord_notification:
notify_discord:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Send message to Discord
- name: Send Release Notification to Discord
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} # Ensure you add your webhook URL to the repository's secrets
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
RELEASE_NAME: ${{ github.event.release.name }}
RELEASE_BODY: ${{ github.event.release.body }}
run: |
# Using jq to safely encode JSON strings
JSON_PAYLOAD=$(jq -n \
--arg content "**Release:** $RELEASE_NAME\n$RELEASE_BODY" \
'{username: "GitHub Release Bot", content: $content}')
# Sending the message to Discord
curl -H "Content-Type: application/json" \
-X POST \
-d '{"username": "Release Bot", "content": "🚀 New Release: **${{ github.event.release.name }}**\n>${{ github.event.release.body }}"}' \
-d "$JSON_PAYLOAD" \
$DISCORD_WEBHOOK

0 comments on commit 217ab74

Please sign in to comment.