Notify on Workflow Complete #71
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
name: Notify on Workflow Complete | |
on: | |
workflow_run: | |
workflows: [verify, release] | |
types: | |
- completed | |
jobs: | |
notify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Slack Notification On Success | |
uses: slackapi/slack-github-action@v1.18.0 | |
if: github.event.workflow_run.conclusion == 'success' | |
with: | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"text": "[vinyldns-js] ${{ github.event.workflow.name }} workflow completed successfully!\nAction: ${{ github.event.workflow_run.html_url }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": ":check_mark: [vinyldns-js] `${{ github.event.workflow.name }}` workflow completed successfully!\nAction: ${{ github.event.workflow_run.html_url }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Send Slack Notification on Failure | |
uses: slackapi/slack-github-action@v1.18.0 | |
if: github.event.workflow_run.conclusion != 'success' | |
with: | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"text": "[vinyldns-js] ${{ github.event.workflow.name }} FAILED!\nAction: ${{ github.event.workflow_run.html_url }}", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": ":x: [vinyldns-js] `${{ github.event.workflow.name }}` FAILED!\nAction: ${{ github.event.workflow_run.html_url }}" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |