Skip to content

Commit ba8523d

Browse files
chore(ci): alert slack on fresh-install failures
Co-authored-by: Nick Perez <[email protected]>
1 parent 37df722 commit ba8523d

File tree

2 files changed

+66
-7
lines changed

2 files changed

+66
-7
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ updates:
4040
# yjs packages
4141
- dependency-name: "yjs"
4242
- dependency-name: "y-prosemirror"
43+
ignore:
44+
# Hono packages are used only in the demo AI server and are not part of
45+
# the main editor/runtime surface area.
46+
- dependency-name: "hono"
47+
- dependency-name: "@hono/node-server"
48+
- dependency-name: "@hono/*"
4349
groups:
4450
editor-dependencies:
4551
patterns:

.github/workflows/fresh-install-tests.yml

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,85 @@ jobs:
2424
timeout-minutes: 30
2525

2626
steps:
27-
- uses: actions/checkout@v6
27+
- id: checkout
28+
uses: actions/checkout@v6
2829

29-
- name: Install pnpm
30+
- id: install_pnpm
31+
name: Install pnpm
3032
uses: pnpm/action-setup@v5
3133

32-
- uses: actions/setup-node@v6
34+
- id: setup_node
35+
uses: actions/setup-node@v6
3336
with:
3437
node-version-file: ".nvmrc"
3538
# Intentionally no pnpm cache — we want a genuinely fresh install
3639

37-
- name: Remove lockfile to force fresh dep resolution
40+
- id: remove_lockfile
41+
name: Remove lockfile to force fresh dep resolution
3842
# Removing pnpm-lock.yaml causes pnpm to resolve all dependencies to
3943
# the latest versions that satisfy the ranges declared in package.json
4044
# (including pnpm-workspace.yaml overrides). This is equivalent to what
4145
# a new user experiences when installing BlockNote in a blank project.
4246
run: rm pnpm-lock.yaml
4347

44-
- name: Install dependencies
48+
- id: install_dependencies
49+
name: Install dependencies
4550
run: pnpm install --no-frozen-lockfile
4651

47-
- name: Build packages
52+
- id: build_packages
53+
name: Build packages
4854
run: pnpm run build
4955
env:
5056
NX_SKIP_NX_CACHE: "true"
5157

52-
- name: Run unit tests
58+
- id: run_unit_tests
59+
name: Run unit tests
5360
run: pnpm run test
5461
env:
5562
NX_SKIP_NX_CACHE: "true"
63+
64+
- name: Notify Slack on workflow failure
65+
if: ${{ failure() }}
66+
env:
67+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
68+
REPOSITORY: ${{ github.repository }}
69+
WORKFLOW: ${{ github.workflow }}
70+
RUN_ID: ${{ github.run_id }}
71+
RUN_NUMBER: ${{ github.run_number }}
72+
RUN_ATTEMPT: ${{ github.run_attempt }}
73+
BRANCH: ${{ github.ref_name }}
74+
run: |
75+
if [ -z "$SLACK_WEBHOOK_URL" ]; then
76+
echo "SLACK_WEBHOOK_URL is not configured; skipping Slack notification."
77+
exit 0
78+
fi
79+
80+
failed_step="Unknown step"
81+
if [ "${{ steps.checkout.outcome }}" = "failure" ]; then
82+
failed_step="Checkout repository"
83+
elif [ "${{ steps.install_pnpm.outcome }}" = "failure" ]; then
84+
failed_step="Install pnpm"
85+
elif [ "${{ steps.setup_node.outcome }}" = "failure" ]; then
86+
failed_step="Setup Node.js"
87+
elif [ "${{ steps.remove_lockfile.outcome }}" = "failure" ]; then
88+
failed_step="Remove lockfile to force fresh dep resolution"
89+
elif [ "${{ steps.install_dependencies.outcome }}" = "failure" ]; then
90+
failed_step="Install dependencies"
91+
elif [ "${{ steps.build_packages.outcome }}" = "failure" ]; then
92+
failed_step="Build packages"
93+
elif [ "${{ steps.run_unit_tests.outcome }}" = "failure" ]; then
94+
failed_step="Run unit tests"
95+
fi
96+
97+
run_url="https://github.com/${REPOSITORY}/actions/runs/${RUN_ID}"
98+
payload=$(cat <<EOF
99+
{
100+
"text": ":warning: Fresh Install Tests failed in *${REPOSITORY}* on branch *${BRANCH}*.\n*Workflow:* ${WORKFLOW}\n*Run:* <${run_url}|#${RUN_NUMBER} (attempt ${RUN_ATTEMPT})>\n*Failed step:* ${failed_step}"
101+
}
102+
EOF
103+
)
104+
105+
curl -sS -X POST \
106+
-H "Content-type: application/json" \
107+
--data "$payload" \
108+
"$SLACK_WEBHOOK_URL"

0 commit comments

Comments
 (0)