-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(slack): new workflow inputs (#163)
* feat(slack): new workflow inputs Add support for custom payloads and additional 'status' values. * test: add additional test runs
- Loading branch information
1 parent
0aaaa49
commit 28d20a1
Showing
2 changed files
with
113 additions
and
6 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,78 @@ | ||
name: Test Slack Workflow Notifications | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- '*' | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
test-slack-workflow-notifications: | ||
runs-on: ubuntu-latest | ||
name: Test slack-actions/workflow-notifications | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Post 'success' notification | ||
uses: ./slack-actions/workflow-notification | ||
with: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFY_SLACK_NOTIFICATION_TEST }} | ||
status: 'success' | ||
success-message: ":test_tube: [TEST]: This is a test *success* notification from `Kong/public-shared-actions`" | ||
|
||
- name: Post 'failure' notification | ||
uses: ./slack-actions/workflow-notification | ||
with: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_ALERT_SLACK_NOTIFICATION_TEST }} | ||
status: 'failure' | ||
failure-message: ":test_tube: [TEST]: This is a test *failure* notification from `Kong/public-shared-actions`" | ||
|
||
- name: Post 'cancelled' notification | ||
uses: ./slack-actions/workflow-notification | ||
with: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_ALERT_SLACK_NOTIFICATION_TEST }} | ||
status: 'cancelled' | ||
|
||
- name: Post 'skipped' notification | ||
uses: ./slack-actions/workflow-notification | ||
with: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_ALERT_SLACK_NOTIFICATION_TEST }} | ||
status: 'skipped' | ||
|
||
- name: Post 'success' notification with custom payload | ||
uses: ./slack-actions/workflow-notification | ||
with: | ||
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_NOTIFY_SLACK_NOTIFICATION_TEST }} | ||
status: 'success' | ||
payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "header", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "[TEST] Kong/public-shared-actions", | ||
"emoji": true | ||
} | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": ":test_tube:" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "This is a test notification with a *custom payload*." | ||
} | ||
] | ||
} | ||
] | ||
} |
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