Slack Workflow Failure Notification #697
This file contains hidden or 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: Slack Workflow Failure Notification | |
| on: | |
| workflow_run: | |
| workflows: | |
| - 'Auto-merge Release PRs' | |
| - 'Backport' | |
| - 'Release' | |
| - 'Validate NPM Token' | |
| types: | |
| - completed | |
| jobs: | |
| notify-on-failure: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'failure' }} | |
| steps: | |
| - name: Send Slack notification | |
| run: | | |
| curl ${{ env.SLACK_WORKFLOW_FAILURE_URL }} -X POST -H "Content-Type: application/json" -d '{"channel_id": "${{ env.CHANNEL_ID }}", "workflow_name": "${{ env.WORKFLOW_NAME }}", "workflow_url": "${{ env.WORKFLOW_URL }}"}' | |
| env: | |
| SLACK_WORKFLOW_FAILURE_URL: ${{ secrets.SLACK_WORKFLOW_FAILURE_URL }} | |
| CHANNEL_ID: 'C050WU03V3N' | |
| WORKFLOW_NAME: ${{ github.event.workflow_run.name }} | |
| WORKFLOW_URL: ${{ github.event.workflow_run.html_url }} |