ci: Allow discord notification to be invoked manually

If this workflow fails during normal releases, this provides a way to
correct issues and re-run if necessary.
pull/137/head
Robert Dailey 2 years ago
parent b3cf6a9c17
commit 9b3b56c31b

@ -20,12 +20,30 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: octokit/request-action@v2.x
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: GET /repos/{org_repo}/releases/tags/{tag}
org_repo: ${{ github.repository }}
tag: ${{ env.TAG }}
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: '3.x' python-version: '3.x'
- run: pip install discord-webhook - run: pip install discord-webhook
# Write changelog to a file to avoid certain characters from being processed by the shell
- run: |
cat >changelog.txt <<"EOL"
${{ fromJSON(steps.release.outputs.data).body }}
EOL
- run: | - run: |
python ci/notify/discord_notify.py \ python ci/notify/discord_notify.py \
'${{ github.event.release.tag_name }}' \ '${{ env.TAG }}' \
'${{ secrets.DISCORD_WEBHOOK }}' \ '${{ secrets.DISCORD_WEBHOOK }}' \
'${{ github.event.release.body }}' changelog.txt

@ -13,13 +13,16 @@ if not webhook_url:
changelog = sys.argv[3] changelog = sys.argv[3]
if not changelog: if not changelog:
print('Pass changelog as third argument') print('Pass path to changelog file as third argument')
exit(1) exit(1)
with open(changelog, 'r') as f:
changelog_text = f.read()
mkdown_desc = f''' mkdown_desc = f'''
**Release Notes** **Release Notes**
``` ```
{changelog} {changelog_text}
``` ```
''' '''

Loading…
Cancel
Save