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+ 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>
You can’t perform that action at this time.
0 commit comments