Skip to content

Commit 096dd73

Browse files
authored
Send notification to Discord if automated publish fails (facebook#32840)
1 parent 7175841 commit 096dd73

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.github/workflows/runtime_prereleases.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ on:
1313
dist_tag:
1414
required: true
1515
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
1620
secrets:
21+
DISCORD_WEBHOOK_URL:
22+
description: 'Discord webhook URL to notify on failure. Only required if enableFailureNotification is true.'
23+
required: false
1724
GH_TOKEN:
1825
required: true
1926
NPM_TOKEN:
@@ -58,3 +65,11 @@ jobs:
5865
GH_TOKEN=${{ secrets.GH_TOKEN }} scripts/release/prepare-release-from-ci.js --skipTests -r ${{ inputs.release_channel }} --commit=${{ inputs.commit_sha }}
5966
cp ./scripts/release/ci-npmrc ~/.npmrc
6067
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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ jobs:
2121
commit_sha: ${{ github.sha }}
2222
release_channel: stable
2323
dist_tag: canary,next
24+
enableFailureNotification: true
2425
secrets:
26+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
2527
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2628
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2729

@@ -40,6 +42,8 @@ jobs:
4042
commit_sha: ${{ github.sha }}
4143
release_channel: experimental
4244
dist_tag: experimental
45+
enableFailureNotification: true
4346
secrets:
47+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
4448
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4549
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)