File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : notify main failure
2+
3+ # Fires only when the build workflow completes on main (push events).
4+ # PR branch builds never match the branches: [main] filter.
5+
6+ on :
7+ workflow_run :
8+ workflows : ["build"]
9+ types : [completed]
10+ branches : [main]
11+
12+ permissions :
13+ contents : read
14+
15+ jobs :
16+ notify :
17+ if : github.event.workflow_run.conclusion == 'failure'
18+ runs-on : ubuntu-22.04
19+ steps :
20+ - name : Notify Slack
21+ continue-on-error : true
22+ env :
23+ SLACK_WEBHOOK_URL : ${{ secrets.OMOQ_SLACK_WEBHOOK_URL }}
24+ run : |
25+ SHORT="${{ github.event.workflow_run.head_sha }}"
26+ SHORT="${SHORT:0:12}"
27+ RUN_URL="${{ github.event.workflow_run.html_url }}"
28+ TEXT=":x: *${{ github.repository }}* \`main\` CI failed — <${RUN_URL}|run>"
29+ curl -s -X POST "$SLACK_WEBHOOK_URL" \
30+ -H "Content-Type: application/json" \
31+ --data "{\"text\": \"${TEXT}\"}"
32+
33+ - name : Notify email
34+ continue-on-error : true
35+ env :
36+ AWS_ACCESS_KEY_ID : ${{ secrets.OMOQ_AWS_ACCESS_KEY_ID }}
37+ AWS_SECRET_ACCESS_KEY : ${{ secrets.OMOQ_AWS_SECRET_ACCESS_KEY }}
38+ AWS_DEFAULT_REGION : us-east-1
39+ run : |
40+ SHORT="${{ github.event.workflow_run.head_sha }}"
41+ SHORT="${SHORT:0:12}"
42+ RUN_URL="${{ github.event.workflow_run.html_url }}"
43+ aws ses send-email \
44+ --from "noreply@ci.openmoq.org" \
45+ --destination '{"ToAddresses":["github-notifications@openmoq.org"]}' \
46+ --message "{
47+ \"Subject\": {\"Data\": \"[o-rly] CI failed on main ${SHORT}\"},
48+ \"Body\": {\"Text\": {\"Data\": \"${{ github.repository }} · main · ${SHORT}\n${RUN_URL}\"}}
49+ }"
You can’t perform that action at this time.
0 commit comments