Skip to content

Commit 7db56b3

Browse files
chore(ci): notify Discord on important workflow failures (tldraw#8826)
In order to catch silent failures in important pipelines (publishing SDK packages, publishing VS Code extensions, deploying the MCP app, daily preview cleanup), this PR adds a Discord notification step to each so failures show up in the same channel where dotcom deploy failures are already posted. A new composite action at `.github/actions/discord-fail-notify` posts a brief message — `@Engineering ❌ <workflow> failed on <ref>: <run-url>` — to `DISCORD_DEPLOY_WEBHOOK_URL` when a job fails. It guards against an empty webhook (logs a warning and skips, so forks and misconfigured envs don't run misleading curl commands) and uses `curl -f` so a bad webhook surfaces as a failed step rather than a silent 4xx. Workflows now wired up: - `bump-versions`, `publish-canary`, `publish-patch`, `publish-new`, `publish-manual`, `publish-branch` — `npm deploy` env - `publish-editor-extensions`, `publish-vscode-extension` — `vsce publish` env (still needs `DISCORD_DEPLOY_WEBHOOK_URL` added to that env in repo settings) - `deploy-mcp-app` — `deploy-production` env - `prune-preview-deploys` — `deploy-staging` env `trigger-production-build` and `publish-templates` have no `environment:` block, so they can't resolve the env-scoped secret; left as-is for now. The role mention `<@&1414904550917144586>` is the same `@Engineering` role already used by `Discord.AT_TEAM_MENTION` in `deploy-dotcom`, `deploy-bemo`, and `deploy-analytics`. ### Change type - [x] `other` ### Test plan Can't trigger a real workflow failure without merging. Verified by: 1. Walking through historical failure `publish-canary` run 25431962448 (S3 `AccessDenied` during `uploadStaticAssets`) — with the new step in place, the `if: failure()` step would have fired after the failing publish step. 2. Confirmed `jq` is preinstalled on the runner class (already used in `deploy-dotcom.yml`). 3. Confirmed the role mention matches the `@Engineering` role used by existing dotcom failure pings. ### Code changes | Section | LOC change | | --------------- | ---------- | | Config/tooling | +87 / -0 |
1 parent ddd841e commit 7db56b3

12 files changed

Lines changed: 98 additions & 0 deletions
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Discord fail notify
2+
description: Post a failure message to the Discord deploy/health channel.
3+
4+
inputs:
5+
webhook-url:
6+
description: Discord webhook URL
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Notify Discord
13+
shell: bash
14+
env:
15+
DISCORD_WEBHOOK_URL: ${{ inputs.webhook-url }}
16+
WORKFLOW: ${{ github.workflow }}
17+
REF: ${{ github.ref_name }}
18+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
19+
run: |
20+
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
21+
echo "::warning::DISCORD_WEBHOOK_URL is empty; skipping Discord notification."
22+
exit 0
23+
fi
24+
payload=$(jq -nc \
25+
--arg content "<@&1414904550917144586> ❌ **${WORKFLOW}** failed on \`${REF}\`: <${RUN_URL}>" \
26+
'{content: $content}')
27+
curl -fsS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL"

.github/workflows/bump-versions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,9 @@ jobs:
5555
env:
5656
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
5757
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
58+
59+
- name: Notify Discord on failure
60+
if: failure()
61+
uses: ./.github/actions/discord-fail-notify
62+
with:
63+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}

.github/workflows/deploy-mcp-app.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ jobs:
4545
VITE_TLDRAW_LICENSE_KEY: ${{ secrets.MCP_APP_TLDRAW_LICENSE_KEY }}
4646
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
4747
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
48+
49+
- name: Notify Discord on failure
50+
if: failure()
51+
uses: ./.github/actions/discord-fail-notify
52+
with:
53+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}

.github/workflows/prune-preview-deploys.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ jobs:
5454
ZERO_R2_BUCKET_NAME: ${{ secrets.ZERO_R2_BUCKET_NAME }}
5555
ZERO_R2_ACCESS_KEY_ID: ${{ secrets.ZERO_R2_ACCESS_KEY_ID }}
5656
ZERO_R2_SECRET_ACCESS_KEY: ${{ secrets.ZERO_R2_SECRET_ACCESS_KEY }}
57+
58+
- name: Notify Discord on failure
59+
if: failure()
60+
uses: ./.github/actions/discord-fail-notify
61+
with:
62+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}

.github/workflows/publish-branch.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ jobs:
5252
github_token: ${{ secrets.GITHUB_TOKEN }}
5353
body: |
5454
Published version ${{ steps.extract_version.outputs.version }} to npm.
55+
56+
- name: Notify Discord on failure
57+
if: failure()
58+
uses: ./.github/actions/discord-fail-notify
59+
with:
60+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}

.github/workflows/publish-canary.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,9 @@ jobs:
5454
-H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \
5555
https://api.github.com/repos/tldraw/tldraw-desktop/dispatches \
5656
-d '{"event_type":"tldraw-release","client_payload":{"version":"${{ steps.publish.outputs.VERSION }}","tag":"next"}}'
57+
58+
- name: Notify Discord on failure
59+
if: failure()
60+
uses: ./.github/actions/discord-fail-notify
61+
with:
62+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}

.github/workflows/publish-editor-extensions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,9 @@ jobs:
5353
OVSX_PAT: ${{ secrets.OVSX_PAT }}
5454
TLDRAW_ENV: ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') }}
5555
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
56+
57+
- name: Notify Discord on failure
58+
if: failure()
59+
uses: ./.github/actions/discord-fail-notify
60+
with:
61+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}

.github/workflows/publish-manual.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,18 @@ jobs:
4747
TLDRAW_BEMO_URL: https://demo.tldraw.xyz
4848
TLDRAW_VERSION_STRING: ${{ inputs.version }}
4949

50+
- name: Notify Discord on failure
51+
if: failure()
52+
uses: ./.github/actions/discord-fail-notify
53+
with:
54+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
55+
5056
publish_templates:
5157
name: Publishes code templates to separate repositories
5258
uses: tldraw/tldraw/.github/workflows/publish-templates.yml@main
5359
if: ${{ needs.deploy.outputs.is_latest_version == 'true' }}
5460
secrets:
5561
HUPPY_PRIVATE_KEY: ${{ secrets.HUPPY_PRIVATE_KEY }}
5662
HUPPY_APP_ID: ${{ vars.HUPPY_APP_ID }}
63+
DISCORD_DEPLOY_WEBHOOK_URL: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
5764
needs: deploy

.github/workflows/publish-new.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,17 @@ jobs:
8383
R2_ACCESS_KEY_SECRET: ${{ secrets.R2_ACCESS_KEY_SECRET }}
8484
TLDRAW_BEMO_URL: https://demo.tldraw.xyz
8585

86+
- name: Notify Discord on failure
87+
if: failure()
88+
uses: ./.github/actions/discord-fail-notify
89+
with:
90+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
91+
8692
publish_templates:
8793
name: Publishes code templates to separate repositories
8894
uses: tldraw/tldraw/.github/workflows/publish-templates.yml@main
8995
secrets:
9096
HUPPY_PRIVATE_KEY: ${{ secrets.HUPPY_PRIVATE_KEY }}
9197
HUPPY_APP_ID: ${{ vars.HUPPY_APP_ID }}
98+
DISCORD_DEPLOY_WEBHOOK_URL: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
9299
needs: [deploy]

.github/workflows/publish-patch.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,18 @@ jobs:
6161
R2_ACCESS_KEY_SECRET: ${{ secrets.R2_ACCESS_KEY_SECRET }}
6262
TLDRAW_BEMO_URL: https://demo.tldraw.xyz
6363

64+
- name: Notify Discord on failure
65+
if: failure()
66+
uses: ./.github/actions/discord-fail-notify
67+
with:
68+
webhook-url: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
69+
6470
publish_templates:
6571
name: Publishes code templates to separate repositories
6672
uses: tldraw/tldraw/.github/workflows/publish-templates.yml@main
6773
if: ${{ needs.deploy.outputs.is_latest_version == 'true' }}
6874
secrets:
6975
HUPPY_PRIVATE_KEY: ${{ secrets.HUPPY_PRIVATE_KEY }}
7076
HUPPY_APP_ID: ${{ vars.HUPPY_APP_ID }}
77+
DISCORD_DEPLOY_WEBHOOK_URL: ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }}
7178
needs: deploy

0 commit comments

Comments
 (0)