-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
64 lines (63 loc) · 1.5 KB
/
action.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
name: Slack Release BOT
author: homeday-de
description: Slack Release BOT used by Homeday engineering
inputs:
webhook_url:
required: true
description: Slack webhook URL
title:
required: true
description: Message title
body:
required: false
description: Message body (markdown allowed but needs to be Slackified first)
context:
required: true
description: Which project is being released?
runs:
using: 'composite'
steps:
- name: Announce on Slack 📢
shell: bash
run: |
header='{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ inputs.title }}"
}
},'
divider='{
"type": "divider"
},'
# Slack markdown doesn't accept empty `text`
if [ ! -z '${{ inputs.body }}' ]
then
body='{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ inputs.body }}"
}
},'
fi
context='{
"type": "context",
"elements": [
{
"type": "plain_text",
"text": "${{ inputs.context }}"
}
]
}'
blocks='"blocks": [
'$header'
'$divider'
'$body'
'$context'
]'
data='{'$blocks'}'
curl ${{ inputs.webhook_url }} \
--request POST \
--header 'Content-type: application/json' \
--data "$data"