Skip to content

Workflow Failure Alerts #4656

Workflow Failure Alerts

Workflow Failure Alerts #4656

name: Workflow Failure Alerts
on:
workflow_run:
workflows:
- Daily Hive Report
- Daily Lines of Code Report
- Daily Snapsync Check
- L1
- L2 (SP1 Backend)
- L2 (without proving)
- L2 Prover
- L2 Prover (TDX)
- L2 TDX build
- LEVM
- Publish Docker
- Publish Ethrex docs to https://docs.ethrex.xyz/
branches:
- main
types:
- completed
permissions:
contents: read
actions: read
jobs:
notify-on-failure:
name: Notify Slack on failure (main)
runs-on: ubuntu-latest
if: >-
${{ github.event.workflow_run.conclusion != 'success' &&
(github.event.workflow_run.event == 'push' ||
github.event.workflow_run.event == 'schedule') }}
steps:
- name: Select Slack webhook
id: select_webhook
run: |
WF_NAME="${{ github.event.workflow_run.name }}"
if echo "$WF_NAME" | grep -Eiq 'L2'; then
echo "webhook=${{ secrets.ETHREX_L2_SLACK_WEBHOOK }}" >> "$GITHUB_OUTPUT"
else
echo "webhook=${{ secrets.ETHREX_L1_SLACK_WEBHOOK }}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout sources
uses: actions/checkout@v4
- name: Collect failed job names
id: failed_jobs
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const collectFailedJobs = require('./scripts/collect_failed_jobs');
await collectFailedJobs({ github, core, context });
- name: Post failure to Slack
env:
REPO: ${{ github.repository }}
WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
CONCLUSION: ${{ github.event.workflow_run.conclusion }}
RUN_HTML_URL: ${{ github.event.workflow_run.html_url }}
RUN_ID: ${{ github.event.workflow_run.id }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
FAILED_JOBS: ${{ steps.failed_jobs.outputs.names }}
run: |
bash .github/scripts/notify_workflow_failure.sh "${{ steps.select_webhook.outputs.webhook }}"