-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalert-ci-failures.yml
More file actions
87 lines (76 loc) · 3.42 KB
/
alert-ci-failures.yml
File metadata and controls
87 lines (76 loc) · 3.42 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Alert on CI Failures
on:
workflow_run:
workflows: ["CI"]
types: [completed]
jobs:
alert:
if: github.event.workflow_run.conclusion == 'failure'
runs-on: ubuntu-latest
steps:
- name: Validate prerequisites
run: |
if [[ -z "${{ secrets.INCIDENT_IO_API_KEY }}" ]] || [[ -z "${{ secrets.INCIDENT_IO_ALERT_SOURCE_ID }}" ]]; then
echo "❌ Missing required secrets for incident.io integration"
echo " 👉 Fix: See docs/SETUP.md Step 4"
exit 1
fi
echo "✅ Prerequisites validated"
- name: Alert incident.io on CI Failure
uses: incident-io/github-action@v0
with:
api-key: ${{ secrets.INCIDENT_IO_API_KEY }}
alert-source-id: ${{ secrets.INCIDENT_IO_ALERT_SOURCE_ID }}
alert-title:
"CI Pipeline Failed in ${{
github.event.workflow_run.repository.full_name }}"
alert-description: |
🚨 CI pipeline is failing on the `${{ github.event.workflow_run.head_branch }}` branch.
**Workflow:** ${{ github.event.workflow_run.name }}
**Run:** [#${{ github.event.workflow_run.run_number }}](https://github.com/${{ github.event.workflow_run.repository.full_name }}/actions/runs/${{ github.event.workflow_run.id }})
**Triggered by:** ${{ github.event.workflow_run.actor.login }}
**Commit:** [${{ github.event.workflow_run.head_sha }}](https://github.com/${{ github.event.workflow_run.repository.full_name }}/commit/${{ github.event.workflow_run.head_sha }})
**Impact:**
- Blocks merging to ${{ github.event.workflow_run.head_branch }}
- May indicate broken tests or build issues
**Next Steps:**
1. Review failed tests in the workflow logs
2. Check recent commits for breaking changes
3. Fix and re-run the pipeline
severity: "error"
source-url: "${{ github.event.workflow_run.html_url }}"
deduplication-key:
"ci-failure-${{ github.event.workflow_run.repository.full_name
}}-${{ github.event.workflow_run.head_branch }}"
custom-fields: |
{
"service": "payment-api",
"team": "payments-team",
"environment": "ci",
"ci_pipeline": "true",
"workflow_type": "ci"
}
resolve:
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Validate prerequisites
run: |
if [[ -z "${{ secrets.INCIDENT_IO_API_KEY }}" ]] || [[ -z "${{ secrets.INCIDENT_IO_ALERT_SOURCE_ID }}" ]]; then
echo "❌ Missing required secrets for incident.io integration"
echo " 👉 Fix: See docs/SETUP.md Step 4"
exit 1
fi
echo "✅ Prerequisites validated"
- name: Resolve incident.io alert on CI Success
uses: incident-io/github-action@v0
with:
api-key: ${{ secrets.INCIDENT_IO_API_KEY }}
alert-source-id: ${{ secrets.INCIDENT_IO_ALERT_SOURCE_ID }}
alert-title:
"CI Pipeline Failed in ${{
github.event.workflow_run.repository.full_name }}"
alert-status: "resolved"
deduplication-key:
"ci-failure-${{ github.event.workflow_run.repository.full_name
}}-${{ github.event.workflow_run.head_branch }}"