Skip to content

Commit 028683b

Browse files
authored
Merge pull request #2626 from input-output-hk/dlachaume/2617/replace-sendgrid-usage-in-ci
ci: replace Sendgrid usage in `Test Notify on Failure` GitHub workflow
2 parents 55ca841 + 7859f59 commit 028683b

File tree

2 files changed

+21
-48
lines changed

2 files changed

+21
-48
lines changed

.github/workflows/scripts/notify-nightly-failure.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/test-notify-on-failure.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@ jobs:
1111
- name: Checkout repository
1212
uses: actions/checkout@v4
1313

14-
- name: Make script executable
15-
shell: bash
14+
- name: Write HTML body to file
1615
run: |
17-
chmod +x ./.github/workflows/scripts/notify-nightly-failure.js
16+
cat > ./email-body.html <<EOF
17+
<h3>Nightly Trigger workflow has failed, see details:</h3>
18+
<ul>
19+
<li><strong>Workflow :</strong> ${{ github.workflow }}</li>
20+
<li><strong>Repository :</strong> ${{ github.repository }}</li>
21+
<li><strong>Run Number :</strong> #${{ github.run_number }}</li>
22+
<li><strong>Logs :</strong> <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">Check logs</a></li>
23+
</ul>
24+
EOF
1825
19-
- name: Send failure notification by email
20-
uses: peter-evans/sendgrid-action@v1
21-
env:
22-
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
23-
SCRIPT_FILEPATH: ./.github/workflows/scripts/notify-nightly-failure.js
24-
SENDGRID_MAIL_FROM: ${{ secrets.CI_NOTIFICATION_EMAIL_FROM }}
25-
SENDGRID_MAIL_TO: ${{ secrets.CI_NOTIFICATION_EMAIL_TO }}
26+
- name: Send failure notification via Mailgun
27+
uses: dawidd6/action-send-mail@v6
28+
with:
29+
server_address: ${{ vars.CI_NOTIFICATION_SMTP_SERVER }}
30+
server_port: ${{ vars.CI_NOTIFICATION_SMTP_PORT }}
31+
username: ${{ secrets.CI_NOTIFICATION_SMTP_LOGIN }}
32+
password: ${{ secrets.CI_NOTIFICATION_SMTP_PASSWORD }}
33+
subject: "🚨 Nightly Workflow Failed"
34+
to: ${{ secrets.CI_NOTIFICATION_EMAIL_TO }}
35+
from: ${{ secrets.CI_NOTIFICATION_EMAIL_FROM }}
36+
html_body: file://email-body.html

0 commit comments

Comments
 (0)