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