Skip to content

Commit 174da08

Browse files
authored
Publish CI failures to Slack (RooCodeInc#4477)
1 parent 1d63fb6 commit 174da08

File tree

2 files changed

+152
-76
lines changed

2 files changed

+152
-76
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'Slack Notification'
2+
description: 'Send Slack notification for workflow failures'
3+
inputs:
4+
webhook-url:
5+
description: 'Slack webhook URL'
6+
required: true
7+
channel:
8+
description: 'Slack channel to notify'
9+
required: true
10+
workflow-name:
11+
description: 'Name of the workflow'
12+
required: true
13+
failed-jobs:
14+
description: 'JSON object containing job results'
15+
required: true
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: Parse failed jobs
21+
id: parse-jobs
22+
shell: bash
23+
run: |
24+
echo "Parsing job results..."
25+
failed_list=""
26+
27+
# Parse the JSON and extract failed jobs
28+
echo '${{ inputs.failed-jobs }}' | jq -r 'to_entries[] | select(.value.result == "failure") | .key' | while read job; do
29+
case $job in
30+
"check-translations") failed_list="${failed_list}❌ Translation check\n" ;;
31+
"knip") failed_list="${failed_list}❌ Knip analysis\n" ;;
32+
"compile") failed_list="${failed_list}❌ Compile & lint\n" ;;
33+
"platform-unit-test") failed_list="${failed_list}❌ Unit tests\n" ;;
34+
"integration-test") failed_list="${failed_list}❌ Integration tests\n" ;;
35+
esac
36+
done
37+
38+
# Remove trailing newline and save to output
39+
echo "failed_jobs<<EOF" >> $GITHUB_OUTPUT
40+
echo -e "$failed_list" | sed '/^$/d' >> $GITHUB_OUTPUT
41+
echo "EOF" >> $GITHUB_OUTPUT
42+
43+
- name: Send Slack notification
44+
uses: 8398a7/action-slack@v3
45+
with:
46+
status: failure
47+
channel: ${{ inputs.channel }}
48+
text: |
49+
🚨 ${{ inputs.workflow-name }} workflow failed on main branch!
50+
51+
Repository: ${{ github.repository }}
52+
Commit: ${{ github.sha }}
53+
Author: ${{ github.actor }}
54+
55+
Failed jobs:
56+
${{ steps.parse-jobs.outputs.failed_jobs }}
57+
58+
View details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
59+
env:
60+
SLACK_WEBHOOK_URL: ${{ inputs.webhook-url }}

.github/workflows/code-qa.yml

Lines changed: 92 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,102 @@
11
name: Code QA Roo Code
22

33
on:
4-
workflow_dispatch:
5-
push:
6-
branches: [main]
7-
pull_request:
8-
types: [opened, reopened, ready_for_review, synchronize]
9-
branches: [main]
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
types: [opened, reopened, ready_for_review, synchronize]
9+
branches: [main]
1010

1111
jobs:
12-
check-translations:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
- name: Setup Node.js and pnpm
18-
uses: ./.github/actions/setup-node-pnpm
19-
- name: Verify all translations are complete
20-
run: node scripts/find-missing-translations.js
12+
check-translations:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
- name: Setup Node.js and pnpm
18+
uses: ./.github/actions/setup-node-pnpm
19+
- name: Verify all translations are complete
20+
run: node scripts/find-missing-translations.js
2121

22-
knip:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- name: Checkout code
26-
uses: actions/checkout@v4
27-
- name: Setup Node.js and pnpm
28-
uses: ./.github/actions/setup-node-pnpm
29-
- name: Run knip checks
30-
run: pnpm knip
22+
knip:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
- name: Setup Node.js and pnpm
28+
uses: ./.github/actions/setup-node-pnpm
29+
- name: Run knip checks
30+
run: pnpm knip
3131

32-
compile:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v4
37-
- name: Setup Node.js and pnpm
38-
uses: ./.github/actions/setup-node-pnpm
39-
- name: Lint
40-
run: pnpm lint
41-
- name: Check types
42-
run: pnpm check-types
32+
compile:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
- name: Setup Node.js and pnpm
38+
uses: ./.github/actions/setup-node-pnpm
39+
- name: Lint
40+
run: pnpm lint
41+
- name: Check types
42+
run: pnpm check-types
4343

44-
platform-unit-test:
45-
runs-on: ${{ matrix.os }}
46-
strategy:
47-
matrix:
48-
os: [ubuntu-latest, windows-latest]
49-
steps:
50-
- name: Checkout code
51-
uses: actions/checkout@v4
52-
- name: Setup Node.js and pnpm
53-
uses: ./.github/actions/setup-node-pnpm
54-
- name: Run unit tests
55-
run: pnpm test
44+
platform-unit-test:
45+
runs-on: ${{ matrix.os }}
46+
strategy:
47+
matrix:
48+
os: [ubuntu-latest, windows-latest]
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
52+
- name: Setup Node.js and pnpm
53+
uses: ./.github/actions/setup-node-pnpm
54+
- name: Run unit tests
55+
run: pnpm test
5656

57-
check-openrouter-api-key:
58-
runs-on: ubuntu-latest
59-
outputs:
60-
exists: ${{ steps.openrouter-api-key-check.outputs.defined }}
61-
steps:
62-
- name: Check if OpenRouter API key exists
63-
id: openrouter-api-key-check
64-
shell: bash
65-
run: |
66-
if [ "${{ secrets.OPENROUTER_API_KEY }}" != '' ]; then
67-
echo "defined=true" >> $GITHUB_OUTPUT;
68-
else
69-
echo "defined=false" >> $GITHUB_OUTPUT;
70-
fi
57+
check-openrouter-api-key:
58+
runs-on: ubuntu-latest
59+
outputs:
60+
exists: ${{ steps.openrouter-api-key-check.outputs.defined }}
61+
steps:
62+
- name: Check if OpenRouter API key exists
63+
id: openrouter-api-key-check
64+
shell: bash
65+
run: |
66+
if [ "${{ secrets.OPENROUTER_API_KEY }}" != '' ]; then
67+
echo "defined=true" >> $GITHUB_OUTPUT;
68+
else
69+
echo "defined=false" >> $GITHUB_OUTPUT;
70+
fi
7171
72-
integration-test:
73-
runs-on: ubuntu-latest
74-
needs: [check-openrouter-api-key]
75-
if: needs.check-openrouter-api-key.outputs.exists == 'true'
76-
steps:
77-
- name: Checkout code
78-
uses: actions/checkout@v4
79-
- name: Setup Node.js and pnpm
80-
uses: ./.github/actions/setup-node-pnpm
81-
- name: Create .env.local file
82-
working-directory: apps/vscode-e2e
83-
run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.local
84-
- name: Run integration tests
85-
working-directory: apps/vscode-e2e
86-
run: xvfb-run -a pnpm test:ci
72+
integration-test:
73+
runs-on: ubuntu-latest
74+
needs: [check-openrouter-api-key]
75+
if: needs.check-openrouter-api-key.outputs.exists == 'true'
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
- name: Setup Node.js and pnpm
80+
uses: ./.github/actions/setup-node-pnpm
81+
- name: Create .env.local file
82+
working-directory: apps/vscode-e2e
83+
run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.local
84+
- name: Run integration tests
85+
working-directory: apps/vscode-e2e
86+
run: xvfb-run -a pnpm test:ci
87+
88+
notify-slack-on-failure:
89+
runs-on: ubuntu-latest
90+
needs: [check-translations, knip, compile, platform-unit-test, integration-test]
91+
if: ${{ always() && github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(needs.*.result, 'failure') }}
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v4
95+
96+
- name: Send Slack notification on failure
97+
uses: ./.github/actions/slack-notify
98+
with:
99+
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
100+
channel: "#ci"
101+
workflow-name: "Code QA"
102+
failed-jobs: ${{ toJSON(needs) }}

0 commit comments

Comments
 (0)