Skip to content

Commit 8537f76

Browse files
michalsosnMichał Sośnicki
and
Michał Sośnicki
authored
chore: add a notification when scheduled e2e tests fail (#243)
Co-authored-by: Michał Sośnicki <[email protected]>
1 parent 03564fe commit 8537f76

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

.github/workflows/tests-e2e.yml

+20
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,23 @@ jobs:
5050
include_passed: true
5151
annotate_notice: true
5252
job_name: "e2e tests"
53+
54+
- name: Notify Slack on failure
55+
if: failure() && github.event_name == 'schedule'
56+
uses: actions/github-script@v6
57+
with:
58+
script: |
59+
const webhookUrl = process.env.SLACK_WEBHOOK_URL;
60+
const payload = {
61+
username: "GitHub Actions",
62+
text: `E2E tests failed in the repository: <https://github.com/${context.repo.owner}/${context.repo.repo}|${context.repo.owner}/${context.repo.repo}>. Please check the details.`
63+
};
64+
await fetch(webhookUrl, {
65+
method: 'POST',
66+
headers: {
67+
'Content-Type': 'application/json'
68+
},
69+
body: JSON.stringify(payload)
70+
});
71+
env:
72+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)