-
Notifications
You must be signed in to change notification settings - Fork 10
70 lines (65 loc) · 1.94 KB
/
slack-integration.yml
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
name: Deployment Status
on:
status
jobs:
report_status:
runs-on: ubuntu-latest
steps:
- name: Send initial Slack notification
id: slack_notification
uses: slackapi/[email protected]
with:
channel-id: "C05AF58H1S9"
payload: |
{
"text": "Deployment status: Deploying",
"attachments": [
{
"pretext": "Deployment is in progress.",
"color": "#ffa500"
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Update Slack notification on failure
if: >-
github.event.state == 'error' ||
github.event.state == 'failure'
id: slack_failure
uses: slackapi/[email protected]
with:
channel-id: "C05AF58H1S9"
update-ts: ${{ steps.slack_notification.outputs.ts }}
payload: |
{
"text": "Deployment status: Failure",
"attachments": [
{
"pretext": "Deployment has failed.",
"color": "#ff0000"
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Update Slack notification on success
if: >-
github.event.state == 'success'
id: slack_success
uses: slackapi/[email protected]
with:
channel-id: "C05AF58H1S9"
update-ts: ${{ steps.slack_notification.outputs.ts }}
payload: |
{
"text": "Deployment status: Success",
"attachments": [
{
"pretext": "Deployment has succeeded.",
"color": "#00ff00"
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}