Skip to content

Commit 176bc5a

Browse files
committed
ci: replace PR notify workflow with main-only failure notification
Remove notify-ci-failure.yml (workflow_run on all builds, showing skipped in Actions tab for every PR). Replace with notify-main-failure.yml which uses branches: [main] filter so it only fires on push-to-main CI failures — never triggered by PR branch builds at all.
1 parent 47025ec commit 176bc5a

2 files changed

Lines changed: 49 additions & 44 deletions

File tree

.github/workflows/notify-ci-failure.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
}"

0 commit comments

Comments
 (0)