mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 11:25:33 +08:00
[CI] Send Discord notification using curl command
This commit is contained in:
35
.github/workflows/build.yml
vendored
35
.github/workflows/build.yml
vendored
@@ -466,6 +466,9 @@ jobs:
|
|||||||
if: always()
|
if: always()
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get -y install jo
|
||||||
- name: Prepare Discord build message
|
- name: Prepare Discord build message
|
||||||
run: |
|
run: |
|
||||||
result=SKIPPED
|
result=SKIPPED
|
||||||
@@ -494,20 +497,22 @@ jobs:
|
|||||||
const release = await octokit.rest.repos.getRelease(query);
|
const release = await octokit.rest.repos.getRelease(query);
|
||||||
core.exportVariable('url', release.data.html_url);
|
core.exportVariable('url', release.data.html_url);
|
||||||
- name: Send Discord build message
|
- name: Send Discord build message
|
||||||
uses: appleboy/discord-action@0.0.3
|
run: |
|
||||||
with:
|
cat >message <<EOF
|
||||||
webhook_id: ${{ secrets.DISCORD_ID }}
|
> :${{ env.emoji }}: \`${{ github.ref }}\`
|
||||||
webhook_token: ${{ secrets.DISCORD_TOKEN }}
|
> **${{ env.result }}** (triggered by ${{ github.event_name }})
|
||||||
message: |
|
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>
|
||||||
> :${{ env.emoji }}: `${{ github.ref }}`
|
EOF
|
||||||
> **${{ env.result }}** (triggered by ${{ github.event_name }})
|
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @-
|
||||||
> <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}>
|
env:
|
||||||
|
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
- name: Send Discord release message
|
- name: Send Discord release message
|
||||||
uses: appleboy/discord-action@0.0.3
|
|
||||||
if: ${{ needs.release.result == 'success' }}
|
if: ${{ needs.release.result == 'success' }}
|
||||||
with:
|
run: |
|
||||||
webhook_id: ${{ secrets.DISCORD_ID }}
|
cat >message <<EOF
|
||||||
webhook_token: ${{ secrets.DISCORD_TOKEN }}
|
> :package: Created draft release \`v${{ needs.preBuild.outputs.version }}\`
|
||||||
message: |
|
> <${{ env.url }}>
|
||||||
> :package: Created draft release `v${{ needs.preBuild.outputs.version }}`
|
EOF
|
||||||
> <${{ env.url }}>
|
jo content=@message | curl -i -H "Accept: application/json" -H "Content-Type: application/json" $WEBHOOK -d @-
|
||||||
|
env:
|
||||||
|
WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
|||||||
Reference in New Issue
Block a user