Skip to content

Commit

Permalink
[OBPIH-6455] slack notification when github onchange job fails (#4683)
Browse files Browse the repository at this point in the history
  • Loading branch information
EWaterman committed Jun 21, 2024
1 parent a769d78 commit 023d3f5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/on-change.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ jobs:

run-backend-tests:
uses: ./.github/workflows/backend-tests.yml

#TODO: Send a email or slack notification if either job fails: https://pihemr.atlassian.net/browse/OBPIH-6455
23 changes: 23 additions & 0 deletions .github/workflows/slack-notifier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Slack Notification on Failures

# Sends a Slack notification whenever the on-change job fails or times out.
on:
workflow_run:
workflows: [On Change]
types: [completed]

jobs:
slack-notify:
runs-on: ubuntu-latest

if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out'

steps:
- uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ github.event.workflow_run.conclusion }}
notification_title: "${{github.event.workflow_run.name}} - ${{github.event.workflow_run.conclusion}} on ${{github.event.workflow_run.head_branch}} - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
message_format: "{emoji} *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} on commit <{commit_url}|{commit_sha}>"
footer: "<${{github.server_url}}/${{github.repository}}|${{github.repository}}>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_BUILD_STATUS_WEBHOOK }}

0 comments on commit 023d3f5

Please sign in to comment.