-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (70 loc) · 2.34 KB
/
Copy pathslack-notify-on-failure.yaml
File metadata and controls
72 lines (70 loc) · 2.34 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
# Generated for Konflux Application openshift-pipelines-core by openshift-pipelines/hack. DO NOT EDIT
name: Slack notification on workflow failure
on:
workflow_run:
workflows: ["*"]
types: [completed]
branches:
- "main"
- "next"
- "nightly"
- "release-v*"
jobs:
notify:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Send Slack notification
uses: slackapi/slack-github-action@v2.1.0
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "🔴 Workflow Failure: ${{ github.event.workflow_run.name }} in ${{ github.event.workflow_run.repository.name }}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository:*\n${{ github.event.workflow_run.repository.full_name }}"
},
{
"type": "mrkdwn",
"text": "*Workflow:*\n${{ github.event.workflow_run.name }}"
},
{
"type": "mrkdwn",
"text": "*Branch:*\n${{ github.event.workflow_run.head_branch }}"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": " <!subteam^S0AS9T1JWHM> please investigate and fix this failure.\nReach out to the release captain if you need assistance."
}
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View Run"
},
"url": "${{ github.event.workflow_run.html_url }}"
}
]
}
]
}