Skip to content

Commit 95148a4

Browse files
committed
Send an e-mail when the nighthly build fails
1 parent 2d047c5 commit 95148a4

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/warn.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Notify when daily build fails
2+
on:
3+
workflow_run:
4+
workflows: ['CI']
5+
types: [completed]
6+
branches: [main]
7+
8+
jobs:
9+
on-failure:
10+
runs-on: ubuntu-latest
11+
if: github.event.workflow_run.conclusion != 'success' && github.event.workflow_run.event == 'schedule'
12+
steps:
13+
- uses: actions/github-script@v6
14+
id: job-url
15+
with:
16+
script: |
17+
const { data } = await github.rest.actions.listJobsForWorkflowRunAttempt({
18+
...context.repo,
19+
run_id: context.runId,
20+
attempt_number: process.env.GITHUB_RUN_ATTEMPT
21+
});
22+
return data.jobs[0].html_url
23+
result-encoding: string
24+
- uses: adelynx/[email protected]
25+
with:
26+
host: ${{ secrets.NOTIFICATION_SMTP_SERVER }}
27+
port: 465
28+
username: '${{ secrets.NOTIFICATION_SMTP_USER }}'
29+
password: '${{ secrets.NOTIFICATION_SMTP_PASSWORD }}'
30+
from: 'Grafana notifications <${{ secrets.NOTIFICATION_SMTP_USER }}>'
31+
to: '${{ secrets.NOTIFICATION_DESTINATION }}'
32+
subject: '🔴 Grafana data source plugin nightly build failed'
33+
34+
body: |
35+
<p>The latest Grafana's data source plugin nightly build has failed and needs manual intervention. Additional information:</p>
36+
<ul>
37+
<li><strong>Process conclussion</strong>: ${{ github.event.workflow_run.conclusion }}</li>
38+
<li><strong>More information</strong>: ${{ steps.job-url.outputs.result }}</li>
39+
</ul>
40+
<p>Thank you!</p>

0 commit comments

Comments
 (0)