Skip to content

Commit

Permalink
feat(ci): Logic E2E fail slack notification
Browse files Browse the repository at this point in the history
  • Loading branch information
AliaksandrRyzhou committed May 6, 2024
1 parent 636d7b3 commit a26389d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/reusable-web-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ on:
required: false
default: false
type: boolean
slack_notification:
description: 'notify if e2e fail via slack'
required: false
default: false
type: boolean

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -186,6 +191,18 @@ jobs:
path: playwright-report
retention-days: 14

- name: Notify Slack Action
uses: ravsamhq/notify-slack-action@v2
if: ${{ always() && inputs.slack_notification }}
with:
status: ${{ job.status }}
notification_title: "{workflow} for 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 }}

component_web:
if: "!contains(github.event.head_commit.message, 'ci skip')"

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/reusable-widget-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
required: false
default: false
type: boolean
slack_notification:
description: 'notify if e2e fail via slack'
required: false
default: false
type: boolean

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down Expand Up @@ -111,3 +116,15 @@ jobs:
with:
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 }}
2 changes: 2 additions & 0 deletions .github/workflows/scheduled_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ 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

release_decision:
Expand Down

0 comments on commit a26389d

Please sign in to comment.