From ca58038c9942f55c2264d9f5f96675a64dce14fb Mon Sep 17 00:00:00 2001 From: Daniel Lando Date: Fri, 29 Sep 2023 09:53:35 +0200 Subject: [PATCH] fix: use github script --- .github/bot-scripts/post-release-notes.js | 3 +++ .github/workflows/discord-publish.yml | 13 ++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/bot-scripts/post-release-notes.js b/.github/bot-scripts/post-release-notes.js index 7c62370349..49a602c9d8 100644 --- a/.github/bot-scripts/post-release-notes.js +++ b/.github/bot-scripts/post-release-notes.js @@ -13,6 +13,9 @@ async function main(param) { const releaseNotes = context.payload.release.body.replace(/(\r\n+|\n+|\r+)/gm, '\n').replace(/(https:\/\/[^)]+)/g, '<$1>'); try { + console.log('Posting release notes to Discord...'); + console.log(releaseNotes); + const response = await fetch(discordWebhookUrl, { method: 'POST', headers: { diff --git a/.github/workflows/discord-publish.yml b/.github/workflows/discord-publish.yml index 68848536c2..ce906a1ab6 100644 --- a/.github/workflows/discord-publish.yml +++ b/.github/workflows/discord-publish.yml @@ -13,12 +13,11 @@ jobs: - name: Check out code uses: actions/checkout@v3 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Post release notes to Discord + - uses: actions/github-script@v6 + name: Post release notes to Discord env: DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - run: node post-release-notes.js + with: + script: | + const script = require('./.github/bot-scripts/post-release-notes.js') + script({github, context}) \ No newline at end of file