Skip to content

Commit 944a303

Browse files
committed
[CI] Send Discord notification using curl command
1 parent 8ec5086 commit 944a303

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,9 @@ jobs:
466466
if: always()
467467

468468
steps:
469+
- name: Install dependencies
470+
run: |
471+
sudo apt-get -y install jo
469472
- name: Prepare Discord build message
470473
run: |
471474
result=SKIPPED
@@ -494,20 +497,22 @@ jobs:
494497
const release = await octokit.rest.repos.getRelease(query);
495498
core.exportVariable('url', release.data.html_url);
496499
- name: Send Discord build message
497-
uses: appleboy/[email protected]
498-
with:
499-
webhook_id: ${{ secrets.DISCORD_ID }}
500-
webhook_token: ${{ secrets.DISCORD_TOKEN }}
501-
message: |
502-
> :${{ env.emoji }}: `${{ github.ref }}`
503-
> **${{ env.result }}** (triggered by ${{ github.event_name }})
504-
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>
500+
run: |
501+
cat >message <<EOF
502+
> :${{ env.emoji }}: \`${{ github.ref }}\`
503+
> **${{ env.result }}** (triggered by ${{ github.event_name }})
504+
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>
505+
EOF
506+
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @-
507+
env:
508+
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
505509
- name: Send Discord release message
506-
uses: appleboy/[email protected]
507510
if: ${{ needs.release.result == 'success' }}
508-
with:
509-
webhook_id: ${{ secrets.DISCORD_ID }}
510-
webhook_token: ${{ secrets.DISCORD_TOKEN }}
511-
message: |
512-
> :package: Created draft release `v${{ needs.preBuild.outputs.version }}`
513-
> <${{ env.url }}>
511+
run: |
512+
cat >message <<EOF
513+
> :package: Created draft release \`v${{ needs.preBuild.outputs.version }}\`
514+
> <${{ env.url }}>
515+
EOF
516+
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @-
517+
env:
518+
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

0 commit comments

Comments
 (0)