Skip to content

reupdate this

reupdate this #72

Workflow file for this run

name: Discord Notification
on:
push:
branches: [main]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up jq
run: sudo apt-get install jq
- name: Get commit info
id: commit
run: |
echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "AUTHOR=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT
echo "AUTHOR_AVATAR=https://github.com/${{ github.actor }}.png" >> $GITHUB_OUTPUT
echo "MESSAGE<<EOF" >> $GITHUB_OUTPUT
git log -1 --pretty=%B >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "URL=https://github.com/${{ github.repository }}/commit/$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "TIMESTAMP=$(git log -1 --pretty=%cI)" >> $GITHUB_OUTPUT
- name: Send Discord Embed
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
run: |
MESSAGE=$(echo "${{ steps.commit.outputs.MESSAGE }}" | sed 's/^> /➡️ /g; s/^- /• /g')
PAYLOAD=$(jq -n \
--arg author "${{ steps.commit.outputs.AUTHOR }}" \
--arg author_avatar "${{ steps.commit.outputs.AUTHOR_AVATAR }}" \
--arg message "$MESSAGE" \
--arg url "${{ steps.commit.outputs.URL }}" \
--arg timestamp "${{ steps.commit.outputs.TIMESTAMP }}" \
--arg sha "${{ steps.commit.outputs.SHA }}" \
'{
"embeds": [{
"title": "🚀 New Update Released!",
"description": ("**Version:** 2.4.8b\n\n" + $message + "\n\n[View Full Changelog](" + $url + ")"),
"color": 5763719,
"footer": {
"text": ("Pushed by " + $author),
"icon_url": $author_avatar
},
"timestamp": $timestamp
}]
}')
curl -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "$DISCORD_WEBHOOK"