Send notification to Discord if automated publish fails (#32840)
Sebastian "Sebbie" Silbermann committed
Apr 9, 2025 at 19:14 UTC
096dd7385dfc6e9732d588189e59c8c6fe7a4975
2 files changed
+19
.github/workflows/runtime_prereleases.yml
+15
@@ -13,7 +13,14 @@ on:
13
dist_tag:
14
required: true
15
type: string
16
+ enableFailureNotification:
17
+ description: 'Whether to notify the team on Discord when the release fails. Useful if this workflow is called from an automation.'
18
+ required: false
19
+ type: boolean
20
secrets:
21
+ DISCORD_WEBHOOK_URL:
22
+ description: 'Discord webhook URL to notify on failure. Only required if enableFailureNotification is true.'
23
+ required: false
24
GH_TOKEN:
25
required: true
26
NPM_TOKEN:
@@ -58,3 +65,11 @@ jobs:
65
GH_TOKEN=${{ secrets.GH_TOKEN }} scripts/release/prepare-release-from-ci.js --skipTests -r ${{ inputs.release_channel }} --commit=${{ inputs.commit_sha }}
66
cp ./scripts/release/ci-npmrc ~/.npmrc
67
scripts/release/publish.js --ci --tags ${{ inputs.dist_tag }}
68
+ - name: Notify Discord on failure
69
+ if: failure() && inputs.enableFailureNotification == true
70
+ uses: tsickert/discord-webhook@86dc739f3f165f16dadc5666051c367efa1692f4
71
+ with:
72
+ webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
73
+ embed-author-name: "GitHub Actions"
74
+ embed-title: 'Publish of $${{ inputs.release_channel }} release failed'
75
+ embed-url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}
.github/workflows/runtime_prereleases_nightly.yml
+4
@@ -21,7 +21,9 @@ jobs:
21
commit_sha: ${{ github.sha }}
22
release_channel: stable
23
dist_tag: canary,next
24
+ enableFailureNotification: true
25
secrets:
26
+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
27
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
28
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
@@ -40,6 +42,8 @@ jobs:
42
commit_sha: ${{ github.sha }}
43
release_channel: experimental
44
dist_tag: experimental
45
+ enableFailureNotification: true
46
secrets:
47
+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
48
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
49
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}