-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperformance-audit-slack-on-failure.yml
More file actions
60 lines (49 loc) · 1.64 KB
/
performance-audit-slack-on-failure.yml
File metadata and controls
60 lines (49 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Performance Audit (Slack on Failure Only)
# This workflow only sends Slack notifications when the audit FAILS
# Use this to reduce notification noise
on:
push:
branches: [ main, development ]
pull_request:
branches: [ main ]
jobs:
performance-audit:
name: Run Performance Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Run performance audit
id: audit
run: |
./dist/bin/check-performance.sh \
--paths "." \
--format json \
--strict \
> audit-results.json
EXIT_CODE=$?
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
exit $EXIT_CODE
continue-on-error: true
- name: Post failure to Slack
if: failure() || steps.audit.outputs.exit_code != '0'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
if [ -n "$SLACK_WEBHOOK_URL" ]; then
./dist/bin/post-to-slack.sh audit-results.json --format detailed
else
echo "⚠️ SLACK_WEBHOOK_URL not configured"
fi
- name: Upload results on failure
if: failure() || steps.audit.outputs.exit_code != '0'
uses: actions/upload-artifact@v4
with:
name: failed-audit-results
path: audit-results.json
retention-days: 30
- name: Fail workflow if audit failed
if: steps.audit.outputs.exit_code != '0'
run: exit 1