mirror of
https://github.com/vondas-network/videobeaux.git
synced 2025-12-05 15:30:02 +01:00
updated Discord integration
This commit is contained in:
21
.github/workflows/discord-notify.yml
vendored
21
.github/workflows/discord-notify.yml
vendored
@@ -5,42 +5,41 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- experimental
|
||||
# add other branches if you want
|
||||
# add other branches here if you like
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Get last commit info
|
||||
id: last_commit
|
||||
run: |
|
||||
echo "message=$(echo '${{ github.event.head_commit.message }}' | sed 's/"/'\''/g')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Send notification to Discord
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
run: |
|
||||
# Basic context from GitHub
|
||||
repo="${{ github.repository }}"
|
||||
pusher="${{ github.actor }}"
|
||||
branch="${{ github.ref_name }}"
|
||||
commit_url="${{ github.event.head_commit.url }}"
|
||||
commit_msg="${{ steps.last_commit.outputs.message }}"
|
||||
|
||||
payload=$(cat <<EOF
|
||||
# Commit message, safely JSON-escaped via toJSON
|
||||
commit_title=${{ toJSON(github.event.head_commit.message) }}
|
||||
|
||||
# Build the Discord payload
|
||||
read -r -d '' payload <<EOF
|
||||
{
|
||||
"content": "**${repo}** updated on branch **${branch}** by **${pusher}**",
|
||||
"embeds": [
|
||||
{
|
||||
"title": "Latest Commit",
|
||||
"description": "${commit_msg}",
|
||||
"title": ${commit_title},
|
||||
"description": "View this commit on GitHub",
|
||||
"url": "${commit_url}"
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
# Send to Discord
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$payload" \
|
||||
|
||||
Reference in New Issue
Block a user