Skip to content

Commit

Permalink
fix: use github script
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Sep 29, 2023
1 parent 5053376 commit ca58038
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/bot-scripts/post-release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/discord-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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})

0 comments on commit ca58038

Please sign in to comment.