Announce in Discord #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Announce in Discord | |
| on: | |
| workflow_run: | |
| workflows: Changelog | |
| types: completed | |
| jobs: | |
| discord: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - run: echo "RELEASE_NAME=$(gh release list --json name,isLatest --jq '.[] | select(.isLatest)|.name')" >> $GITHUB_ENV | |
| - run: gh release view $RELEASE_NAME --json body --jq '.body' >> CHANGELOG.md | |
| - run: > | |
| jq -n --arg content "$(cat CHANGELOG.md)" '{ | |
| embeds: [{ | |
| title: "Game Update", | |
| description: $content, | |
| color: 5793266 | |
| }] | |
| }' > data.json | |
| - run: > | |
| curl -sS ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| -d @data.json | |
| -H "Content-Type: application/json" | |
| -X POST |