-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (55 loc) · 1.75 KB
/
slack-notification.yaml
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
name: slack-notification
on:
workflow_call:
inputs:
job_status:
description: 'The status of the job'
required: true
type: string
channel:
description: 'The channel to notify'
required: false
default: '#test-zone'
type: string
jobs:
slackNotification:
name: Slack Notification
runs-on: ubuntu-latest
steps:
- name: Post to a Slack channel
id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ inputs.channel }}
payload: |
{
"attachments": [
{
"color": "#e01e5a",
"fields": [
{
"title": "Repo",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>"
},
{
"title": "${{ github.workflow }}",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ inputs.job_status }}>"
},
{
"title": "Triggered by",
"short": true,
"value": "<${{ github.server_url }}/${{ github.triggering_actor }}|${{ github.triggering_actor }}>"
},
{
"title": "Branch",
"short": "true",
"value": "${{ github.ref_name }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}