Skip to content

Commit

Permalink
Send an e-mail when the nighthly build fails
Browse files Browse the repository at this point in the history
  • Loading branch information
lpetrora committed Jan 12, 2024
1 parent 6bb0fa5 commit ce2b78e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/warn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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>

0 comments on commit ce2b78e

Please sign in to comment.