-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (52 loc) · 1.9 KB
/
slack.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
# Workflow only runs after the specified workflows have concluded running to completion. It then checks if they have
# been successful or failed. Appropriate messages are then sent afterwards on each event type
# Ref https://github.com/rtCamp/action-slack-notify
name: Slack Notification
on:
workflow_run:
workflows:
- "Lint"
- "Test"
- "Build"
- "Release"
types:
- completed
jobs:
onSuccess:
name: Success Notification
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: cicd
SLACK_COLOR: "good"
SLACK_ICON: https://github.com/ratholos.png?size=48
SLACK_ICON_EMOJI: ":large_green_circle:"
SLACK_USERNAME: Ratholos
SLACK_TITLE: ${{ github.repository }} - ${{ github.event.workflow_run.name }} Workflow Succeeded
SLACK_MESSAGE: 'Success'
SLACK_FOOTER: "Regards, Ratholos"
SLACK_WEBHOOK: ${{ secrets.PIPELINES_SLACK_WEBHOOK }}
onFailure:
name: Failure Notification
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: cicd
SLACK_COLOR: "danger"
SLACK_ICON: https://github.com/ratholos.png?size=48
SLACK_ICON_EMOJI: ":red_circle:"
SLACK_USERNAME: Ratholos
SLACK_TITLE: ${{ github.repository }} - ${{ github.event.workflow_run.name }} Workflow Failed
SLACK_MESSAGE: ':cry:'
SLACK_FOOTER: "Regards, Ratholos"
SLACK_WEBHOOK: ${{ secrets.PIPELINES_SLACK_WEBHOOK }}