Skip to content

Commit

Permalink
Add slack notification for canary build failures (apache#42394)
Browse files Browse the repository at this point in the history
* add slack notifier
  • Loading branch information
romsharon98 authored and ellisms committed Nov 13, 2024
1 parent 56378b7 commit 487a645
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
IMAGE_TAG: "${{ github.event.pull_request.head.sha || github.sha }}"
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
VERBOSE: "true"

concurrency:
Expand Down Expand Up @@ -669,3 +670,31 @@ jobs:
include-success-outputs: ${{ needs.build-info.outputs.include-success-outputs }}
docker-cache: ${{ needs.build-info.outputs.docker-cache }}
canary-run: ${{ needs.build-info.outputs.canary-run }}

notify-slack-failure:
name: "Notify Slack on Failure"
if: github.event_name == 'schedule' && failure()
runs-on: ["ubuntu-22.04"]
steps:
- name: Notify Slack
id: slack
uses: slackapi/slack-github-action@v1.27.0
with:
channel-id: 'zzz_webhook_test'
# yamllint disable rule:line-length
payload: |
{
"text": "🚨🕒 Scheduled CI Failure Alert 🕒🚨\n\n*Details:* <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View the failure log>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🚨🕒 Scheduled CI Failure Alert 🕒🚨\n\n*Details:* <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View the failure log>"
}
}
]
}
# yamllint enable rule:line-length
env:
SLACK_BOT_TOKEN: ${{ env.SLACK_BOT_TOKEN }}

0 comments on commit 487a645

Please sign in to comment.