-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
57 lines (53 loc) · 2.13 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
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
name: "Slack Status Notification"
author: Release Engineering <[email protected]>
description: Slack Status Notification (replacement for circleci_slack_status orb).
inputs:
status:
description: Pass through the GH conclusion/result value (success, failure, cancelled, or skipped)
required: true
type: string
slack-webhook-url:
description: Slack application webhook URL to post the message (if unsure, ask RelEng to create one)
required: true
type: string
success-message:
description: The message (in Markdown) to be sent when status is 'success'. If unset, no message will be sent
default: ''
type: string
failure-message:
description: The message (in Markdown) to be sent when status is 'failure'. f unset, no message will be sent
default: ''
type: string
cancelled-message:
description: The message (in Markdown) to be sent when status is 'cancelled'. If unset, no message will be sent
default: ''
type: string
skipped-message:
description: The message (in Markdown) to be sent when status is 'skipped'. If unset, no message will be sent
default: ''
type: string
runs:
using: "composite"
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: this
env:
INPUT_STATUS: ${{inputs.status}}
INPUT_SUCCESS-MESSAGE: ${{inputs.success-message}}
INPUT_FAILURE-MESSAGE: ${{inputs.failure-message}}
INPUT_CANCELLED-MESSAGE: ${{inputs.cancelled-message}}
INPUT_SKIPPED-MESSAGE: ${{inputs.skipped-message}}
with:
# github-token: uncomment-this-line-for-local-act-testing
script: |
return require(process.env.GITHUB_ACTION_PATH + '/main.js')({context, core})
- name: Send Status
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
env:
SLACK_WEBHOOK_URL: ${{ inputs.slack-webhook-url }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
if: ${{ steps.this.outputs.result != '' }}
with:
payload: ${{ steps.this.outputs.result }}