Skip to content

Commit

Permalink
add slack notifier
Browse files Browse the repository at this point in the history
  • Loading branch information
romsharon98 committed Sep 21, 2024
1 parent f278e62 commit f05d8e2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ env:
GITHUB_USERNAME: ${{ github.actor }}
IMAGE_TAG: "${{ github.event.pull_request.head.sha || github.sha }}"
VERBOSE: "true"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
Expand Down Expand Up @@ -669,3 +670,19 @@ 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: failure()
runs-on: ["ubuntu-22.04"]
steps:
- name: Notify Slack
run: |
curl -X POST -H 'Content-type: application/json' --data '{
"text": "The GitLab CI workflow *Tests* has failed.\n
Repository: ${{ github.repository }}\n
Branch: ${{ github.ref_name }}\n
Commit: ${{ github.sha }}\n
Check the details at:
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}' ${{ env.SLACK_WEBHOOK_URL }}

0 comments on commit f05d8e2

Please sign in to comment.