-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from cenevan/main
Create Slack Notification GHA workflow
- Loading branch information
Showing
4 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Reusable workflow to create slack notifications | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
short-desc: | ||
description: 'Description of the slack messsage' | ||
required: true | ||
type: string | ||
title: | ||
description: 'Title of slack message' | ||
required: true | ||
type: string | ||
img-url: | ||
description: 'url of image in slack message' | ||
required: true | ||
type: string | ||
img-alt-text: | ||
description: 'alt text of image' | ||
required: true | ||
type: string | ||
secrets: | ||
channel-name: | ||
required: true | ||
slack-bot-token: | ||
required: true | ||
|
||
jobs: | ||
slack-notif: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Push Slack Notification | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: ${{ secrets.channel-name }} | ||
payload: | | ||
{ | ||
"text": "${{ inputs.short-desc }}", | ||
"blocks": [ | ||
{ "type": "divider" }, | ||
{ | ||
"type": "image", | ||
"title": { | ||
"type": "plain_text", | ||
"text": "${{ inputs.title }}" | ||
}, | ||
"image_url": "${{ inputs.img-url }}", | ||
"alt_text": "${{ inputs.img-alt-text }}" | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "${{ inputs.short-desc }}" | ||
} | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.slack-bot-token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Workflow Configuration | ||
|
||
## Name | ||
|
||
Reusable workflow name | ||
|
||
## Triggers | ||
|
||
Workflow triggers | ||
|
||
## Inputs | ||
|
||
- Workflow input #1 (type): | ||
- Workflow input #2 (type): | ||
|
||
## Secrets | ||
|
||
- Secret name #1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Workflow Configuration | ||
|
||
## Name | ||
|
||
Reusable workflow to create slack notifications | ||
|
||
## Triggers | ||
|
||
The workflow is triggered using workflow_call, allowing it to be reused in other workflows. | ||
|
||
## Inputs | ||
|
||
- short-desc (string, required): A brief description of the Slack message. | ||
- title (string, required): The title of the Slack message. | ||
- img-url (string, required): URL of the image to be included in the Slack message. Requires downloadable image file (.png, .jpg, etc.) | ||
- img-alt-text (string, required): Alt text for the image. | ||
|
||
## Secrets | ||
|
||
- channel-name (required): The name of the Slack channel where the message will be sent. | ||
- slack-bot-token (required): The token for the Slack bot to authenticate the API request. |