-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (45 loc) · 1.84 KB
/
slack-notify.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
name: Reusable CI success/failure Slack notification bot
on:
workflow_call:
inputs:
result:
description: "Result of running the caller workflow (e.g., 'success', 'failure', 'skipped')"
required: true
type: string
channel:
description: "Slack channel to which the bot notification is sent"
required: true
type: string
message:
description: "Sub-string to include in the message, e.g. about which action has failed/succeeded"
required: true
type: string
secrets:
SLACK_WEBHOOK:
required: true
jobs:
report-to-slack:
runs-on: ubuntu-latest
steps:
- name: Send build success notification
if: inputs.result == 'success'
uses: rtCamp/[email protected]
env:
SLACK_MESSAGE: ${{ github.repository }} ${{ inputs.message }} ${{ github.run_number }} has succeeded
SLACK_TITLE: Build Success
SLACK_CHANNEL: ${{ inputs.channel }}
SLACK_USERNAME: GitHub Build Bot
SLACK_ICON: https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_512.png
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
- name: Send build failure notification
if: inputs.result == 'failure'
uses: rtCamp/[email protected]
env:
SLACK_COLOR: '#FF0000'
SLACK_LINK_NAMES: true
SLACK_MESSAGE: '<!here> ${{ github.repository }} ${{ inputs.message }} ${{ github.run_number }} has failed'
SLACK_TITLE: Build Failure!
SLACK_CHANNEL: ${{ inputs.channel }}
SLACK_USERNAME: GitHub Build Bot
SLACK_ICON: https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_512.png
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}