-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
55 lines (55 loc) · 1.83 KB
/
action.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
name: Awesome action
description: Wraps the slack notification action
inputs:
payload:
description: String payload to send
required: false
default: ''
payload-file-path:
description: Path to the template with the payload to send
required: false
default: ''
replacements:
description: Replacements to perform on the payload file
required: false
default: ''
channel-id:
description: Channel to send the notification to
required: true
slack-bot-token:
description: Access token to the Slack API
required: true
runs:
using: composite
steps:
- name: Fix Slack notification template
if: ${{ inputs.payload-file-path != '' }}
id: fix_template
run: |
${{ github.action_path }}/script.sh ${{ inputs.payload-file-path }}
shell: bash
env:
REPL: ${{ inputs.replacements }}
- name: Send Slack notification template
if: ${{ inputs.payload-file-path != '' && steps.fix_template.outcome == 'success' }}
id: slack-notification-template
uses: slackapi/[email protected]
with:
channel-id: ${{ inputs.channel-id }}
payload-file-path: ${{ inputs.payload-file-path }}.fixed
env:
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
- name: Send Slack notification payload
if: ${{ inputs.payload-file-path == '' && inputs.payload != '' }}
id: slack-notification-payload
uses: slackapi/[email protected]
with:
channel-id: ${{ inputs.channel-id }}
payload: ${{ inputs.payload }}
env:
SLACK_BOT_TOKEN: ${{ inputs.slack-bot-token }}
- name: Clean temporal files
id: clean
if: ${{ always() && inputs.payload-file-path != '' && steps.fix_template.outcome == 'success' }}
run: rm ${{ inputs.payload-file-path }}.fixed
shell: bash