From ab5391b490bd28605b9117bf372498262c3a64d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Ferdinand?= <32671211+Ferdinand99@users.noreply.github.com> Date: Wed, 21 May 2025 17:41:32 +0200 Subject: [PATCH] Create discord-changelog.yml --- .github/workflows/discord-changelog.yml | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/discord-changelog.yml diff --git a/.github/workflows/discord-changelog.yml b/.github/workflows/discord-changelog.yml new file mode 100644 index 0000000..0a2bf7f --- /dev/null +++ b/.github/workflows/discord-changelog.yml @@ -0,0 +1,53 @@ +name: Post Changelog to Discord + +on: + push: + branches: + - main + paths: + - 'Changelog.md' + +jobs: + post_to_discord: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Extract latest changelog block + id: changelog + run: | + changelog_block=$(awk ' + BEGIN { found=0 } + /^## 🔹 Version / { + if (found) exit; + found=1; + print $0; + next; + } + found { + if (/^## /) exit; + print $0; + } + ' Changelog.md) + + # Escape for JSON + changelog_block=$(echo "$changelog_block" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + echo "BLOCK=$changelog_block" >> $GITHUB_OUTPUT + + - name: Send to Discord + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_CHANGELOG_WEBHOOK }} + run: | + curl -H "Content-Type: application/json" \ + -X POST \ + -d "{ + \"username\": \"Newt Changelog Bot\", + \"embeds\": [{ + \"title\": \"📦 New Changelog Update\", + \"description\": \"${{ steps.changelog.outputs.BLOCK }}\", + \"color\": 7506394 + }] + }" \ + $DISCORD_WEBHOOK