From 1509deb462a0bc0f0d5768abf817295970639614 Mon Sep 17 00:00:00 2001 From: KobeW50 <84587632+KobeW50@users.noreply.github.com> Date: Sat, 21 Dec 2024 00:58:49 -0500 Subject: [PATCH] ci: Use semi-transparent Discord embed color (#111) --- .github/workflows/discord_ping_on_release.yml | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/discord_ping_on_release.yml b/.github/workflows/discord_ping_on_release.yml index a826fcd438..5f5cd3d98f 100644 --- a/.github/workflows/discord_ping_on_release.yml +++ b/.github/workflows/discord_ping_on_release.yml @@ -10,13 +10,33 @@ jobs: steps: - uses: sarisia/actions-status-discord@v1 if: always() + id: webhook # set id to reference output payload later with: - webhook: ${{ secrets.DISCORD_WEBHOOK_URL }} - username: ReVanced Extended - color: 0xff5252 + ack_no_webhook: true # suppress warning nodetail: true notimestamp: true + + username: ReVanced Extended content: "<@&1271197877724643461>" title: "Patches `${{ github.event.release.tag_name }}` has been released!" description: | - Click [here](${{ github.event.release.html_url }}) to read the changelog and release notes. \ No newline at end of file + Click [here](${{ github.event.release.html_url }}) to read the changelog and release notes. + + - run: npm install axios + - uses: actions/github-script@v7 + env: + WEBHOOK_PAYLOAD: ${{ steps.webhook.outputs.payload }} + WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + with: + script: | + const axios = require("axios") + + const { WEBHOOK_PAYLOAD, WEBHOOK_URL } = process.env + + const payload = JSON.parse(WEBHOOK_PAYLOAD) + + // remove the color field to make it transparent + delete payload.embeds[0].color + + // send to Discord + axios.post(WEBHOOK_URL, payload)