Skip to content

Commit 4386d59

Browse files
ci: Testing Email Sending Feature from the CI
Just to test the CI, NOT to merged in the repo.
1 parent 58f0c16 commit 4386d59

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: Test Email Notification
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
test-email:
9+
name: "Test email on failure"
10+
runs-on: ubuntu-24.04
11+
steps:
12+
- name: Dummy step that fails
13+
run: |
14+
echo "STEP=Test dummy failure" >> "$GITHUB_ENV"
15+
echo "This step will fail to trigger the email..."
16+
exit 1
17+
18+
- name: Send email on failure
19+
if: ${{ failure() }}
20+
uses: dawidd6/action-send-mail@v17
21+
with:
22+
server_address: smtp.gmail.com
23+
server_port: 465
24+
secure: true
25+
username: ${{ secrets.EMAIL_USERNAME }}
26+
password: ${{ secrets.EMAIL_PASSWORD }}
27+
from: ${{ secrets.EMAIL_USERNAME }}
28+
to: ${{ vars.DISTRIBUTION_LIST }}
29+
subject: "TEST: CI Failure - Step ${{ env.STEP }}"
30+
convert_markdown: true
31+
html_body: |
32+
<html>
33+
<body>
34+
<p><strong>THIS IS A TEST</strong> - GitHub Workflow ${{ github.workflow }} Failed!</p>
35+
<p>This is a dummy test to verify the email notification system works.</p>
36+
<strong>Failure Details:</strong><br/>
37+
<strong>Event: </strong>${{ github.event_name }}<br/>
38+
<strong>Job: </strong>${{ github.job }}<br/>
39+
<strong>Step: </strong>${{ env.STEP }}<br/>
40+
<strong>Action: </strong><a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}</a><br/>
41+
</body>
42+
</html>

0 commit comments

Comments
 (0)