Skip to content

Commit

Permalink
Merge pull request #1082 from elementary-data/ele-1158-notify-tests-f…
Browse files Browse the repository at this point in the history
…ails

Notify tests fails to slack
  • Loading branch information
Noa Kurman authored Aug 21, 2023
2 parents 1614c21 + 0a7546f commit 550d459
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/notify_slack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Notify Slack
on:
workflow_call:
inputs:
result:
type: string
required: true
run_id:
type: string
required: false
workflow_name:
type: string
required: true

jobs:
notify:
name: Notify Slack Failure
runs-on: ubuntu-latest
if: ${{ inputs.result == 'failure' }}
steps:
- name: Slack Notification
uses: tokorom/action-slack-incoming-webhook@main
env:
INCOMING_WEBHOOK_URL: ${{ secrets.DEPLOY_SLACK_WEBHOOK_URL }}
with:
text: Scheduled Run Failed - ${{ inputs.workflow_name }}
attachments: |
[
{
"color": "danger",
"fields":
[
{
"title": "URL:",
"value": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ inputs.run_id }}"
}
]
}
]
14 changes: 14 additions & 0 deletions .github/workflows/test-all-warehouses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,17 @@ jobs:
dbt-version: ${{ matrix.dbt-version }}
generate-data: ${{ inputs.generate-data || false }}
secrets: inherit

notify_failures:
name: Notify Slack
needs: test
if: |
always() &&
contains(needs.test.result, 'failure') &&
# ! cancelled() &&
${{ github.event_name == 'schedule' }}
uses: ./.github/workflows/notify_slack.yml
with:
result: "failure"
run_id: ${{ github.run_id }}
workflow_name: "Test all warehouse platforms"
14 changes: 14 additions & 0 deletions .github/workflows/test-github-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,17 @@ jobs:
with:
name: edr.log
path: edr_target/edr.log

notify_failures:
name: Notify Slack
needs: test
if: |
always() &&
contains(needs.test.result, 'failure') &&
! cancelled() &&
${{ github.event_name == 'schedule' }}
uses: ./.github/workflows/notify_slack.yml
with:
result: "failure"
run_id: ${{ github.run_id }}
workflow_name: "Test Elementary GitHub action"

0 comments on commit 550d459

Please sign in to comment.