Skip to content

Commit febef60

Browse files
committed
f
1 parent b8481e7 commit febef60

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/actions/slack-alert/action.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Slack alert
3-
description: Send an alert to a Slack channel
3+
description: Send an alert to a Slack channel using workflow builder
44
inputs:
55
inputs:
66
description: Textual representation of workflow inputs
@@ -17,6 +17,16 @@ inputs:
1717
required: false
1818
default: "N/A"
1919
type: string
20+
# Typically this would be a secret.
21+
slack-webhook-url:
22+
description: Slack workflow builder webhook URL
23+
required: true
24+
type: string
25+
# Typically this would be a secret or variable.
26+
slack-channel-id:
27+
description: ID of Slack channel to send alert to
28+
required: true
29+
type: string
2030
runs:
2131
using: composite
2232
steps:
@@ -32,8 +42,8 @@ runs:
3242
"workflow-url": "${{ env.WORKFLOW_URL }}"
3343
}
3444
env:
35-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
36-
SLACK_CHANNEL_ID: ${{ vars.SLACK_CHANNEL_ID }}
45+
SLACK_WEBHOOK_URL: ${{ inputs.slack-webhook-url }}
46+
SLACK_CHANNEL_ID: ${{ inputs.slack-channel-id }}
3747
INPUTS: ${{ inputs.inputs }}
3848
MESSAGE: ${{ inputs.message }}
3949
RESULTS_URL: ${{ inputs.results-url }}

.github/workflows/terraform-github.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,8 @@ jobs:
117117
run: terraform apply -auto-approve -input=false
118118

119119
- name: Send message to Slack via Workflow Builder
120-
uses: .github/actions/slack-alert
120+
uses: ./.github/actions/slack-alert
121+
with:
122+
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
123+
slack-channel-id: ${{ vars.SLACK_CHANNEL_ID }}
121124
if: failure()

0 commit comments

Comments
 (0)