Skip to content

Commit

Permalink
fix(actions): Consolidate slack notification logic on test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
SokratisVidros committed May 9, 2024
1 parent a8906b8 commit 21d222b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 62 deletions.
17 changes: 1 addition & 16 deletions .github/workflows/reusable-api-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ on:
description: 'job name [options: novu/api-ee, novu/api]'
required: true
type: string
slack_notification:
description: 'notify if e2e fail via slack'
required: false
default: false
type: boolean
environment:
required: false
default: 'Development'
Expand Down Expand Up @@ -122,14 +117,4 @@ jobs:
run: |
cd apps/api && pnpm test
- name: Notify Slack Action
uses: ravsamhq/notify-slack-action@v2
if: ${{ always() && inputs.slack_notification }}
with:
status: ${{ job.status }}
notification_title: "{workflow} for API has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Run URL {run_url}\nCommit URL{commit_url}"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- uses: ./.github/actions/slack/notify-on-failure
29 changes: 2 additions & 27 deletions .github/workflows/reusable-web-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ on:
required: false
default: false
type: boolean
slack_notification:
description: 'notify if e2e fail via slack'
required: false
default: false
type: boolean
environment:
required: false
default: 'Development'
Expand Down Expand Up @@ -200,17 +195,7 @@ jobs:
path: playwright-report
retention-days: 14

- name: Notify Slack Action
uses: ravsamhq/notify-slack-action@v2
if: ${{ inputs.slack_notification && needs.e2e_web.result == 'failure' }}
with:
status: "failure"
notification_title: "{workflow} for WEB has failed"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Run URL {run_url}\nCommit URL{commit_url}"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- uses: ./.github/actions/slack/notify-on-failure

component_web:
if: "!contains(github.event.head_commit.message, 'ci skip')"
Expand Down Expand Up @@ -257,14 +242,4 @@ jobs:
name: cypress-screenshots
path: apps/web/cypress/screenshots

- name: Notify Slack Action
uses: ravsamhq/notify-slack-action@v2
if: ${{ always() && inputs.slack_notification }}
with:
status: ${{ job.status }}
notification_title: "{workflow} for Component WEB has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Run URL {run_url}\nCommit URL{commit_url}"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- uses: ./.github/actions/slack/notify-on-failure
17 changes: 1 addition & 16 deletions .github/workflows/reusable-widget-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ on:
required: false
default: false
type: boolean
slack_notification:
description: 'notify if e2e fail via slack'
required: false
default: false
type: boolean
environment:
required: false
default: 'Development'
Expand Down Expand Up @@ -122,14 +117,4 @@ jobs:
name: cypress-videos
path: apps/widget/cypress/videos

- name: Notify Slack Action
uses: ravsamhq/notify-slack-action@v2
if: ${{ always() && inputs.slack_notification }}
with:
status: ${{ job.status }}
notification_title: "{workflow} for Widget has {status_message}"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Run URL {run_url}\nCommit URL{commit_url}"
notify_when: "failure"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- uses: ./.github/actions/slack/notify-on-failure
3 changes: 0 additions & 3 deletions .github/workflows/scheduled_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ jobs:
secrets: inherit
with:
ee: true
slack_notification: true

test_widget:
name: Test Widget Cypress
uses: ./.github/workflows/reusable-widget-e2e.yml
with:
ee: true
slack_notification: true
secrets: inherit

test_unit_api:
Expand All @@ -44,7 +42,6 @@ jobs:
test-e2e-affected: true
test-e2e-ee-affected: true
job-name: ${{ matrix.name }}
slack_notification: true
secrets: inherit

release_decision:
Expand Down

0 comments on commit 21d222b

Please sign in to comment.