-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 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,25 @@ | ||
name: 'Send Slack Message' | ||
description: 'Sends a message to a specified Slack channel' | ||
|
||
inputs: | ||
slack_token: | ||
description: 'Slack Bot User OAuth Token' | ||
required: true | ||
message: | ||
description: 'Message to send to Slack' | ||
required: true | ||
channel_id: | ||
description: 'Slack Channel ID to send message to' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Post plain text message to a Slack channel | ||
uses: slackapi/slack-github-action@v2.0.0 | ||
with: | ||
method: chat.postMessage | ||
token: ${{ inputs.slack_token }} | ||
payload: | | ||
channel: ${{ inputs.channel_id }} | ||
text: ${{ inputs.message }} |
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,31 @@ | ||
name: Test Actions on Push | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
inputs: | ||
message: | ||
description: 'Message to send to Slack' | ||
required: true | ||
default: 'Hello, world!' | ||
channel_id: | ||
description: 'Slack Channel ID to send message to' | ||
required: true | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
slack_token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
message: ${{ inputs.message }} | ||
channel_id: ${{ inputs.channel_id || secrets.SLACK_CHANNEL_ID }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Send Slack Message | ||
uses: ./.github/actions/slack | ||
with: | ||
message: ${{ inputs.message }} | ||
channel_id: ${{ inputs.channel_id }} |