v4.0.45.1 #11
Workflow file for this run
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: Notify Discord on Release | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
- edited | |
jobs: | |
notify-discord: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v6 | |
env: | |
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const release = context.payload.release; | |
const message = `New release: ${release.name} \n ${release.body}`; | |
const options = { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify({ | |
username: 'Release Bot', | |
avatar_url: 'https://getautoclicker.com/docs/4.x/assets/brand/bootstrap-social-logo.png', | |
content: '${{ github.actor }} published a new release: [${{ github.event.release.tag_name }}](${{ github.event.release.html_url }})\n\n**Release Notes:**\n${{ github.event.release.body }}', | |
}), | |
}; | |
const response = await fetch(process.env.DISCORD_WEBHOOK_URL, options); | |
console.log(response.status); |