Skip to content

PythonBot - Workflow Failure Notifier #5389

PythonBot - Workflow Failure Notifier

PythonBot - Workflow Failure Notifier #5389

Workflow file for this run

name: PythonBot - Workflow Failure Notifier
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (no PR comment posting)'
type: boolean
default: true
failed_run_id:
description: 'Failed workflow run ID for testing (optional)'
required: false
workflow_run:
workflows:
- "PR Formatting"
- "PR Changelog Check"
- "Hiero Solo Integration & Unit Tests"
- "Run Examples"
types:
- completed
permissions:
contents: read
pull-requests: read
issues: write
concurrency:
group: "workflow-failure-${{ github.event.workflow_run.head_branch || github.run_id }}"
cancel-in-progress: true
jobs:
notify-pr:
if: ${{ github.event.workflow_run.conclusion == 'failure' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
env:
# Behaviour:
# - workflow_run: DRY_RUN = 0 (real actions)
# - workflow_dispatch: DRY_RUN derived from the "dry_run" input
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.dry_run == 'true' && '1' || '0') || '0' }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '20'
- name: Notify PR of workflow failure
if: github.event_name != 'workflow_dispatch' || github.event.inputs.failed_run_id != ''
env:
FAILED_WORKFLOW_NAME: ${{ github.event.workflow_run.name || 'Manual Test Run' }}
FAILED_RUN_ID: ${{ github.event.inputs.failed_run_id || github.event.workflow_run.id }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
DRY_RUN: ${{ env.DRY_RUN }}
PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number || '' }}
run: node .github/scripts/bot-workflows.js