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