Skip to content

Auto-Retry Failed Run #3731

Auto-Retry Failed Run

Auto-Retry Failed Run #3731

Workflow file for this run

name: Auto-Retry Failed Run
# Trigger under the same conditions as Tests workflow
on:
workflow_run:
workflows: ["Tests"]
types:
- completed
workflow_dispatch: # Added to test and debug if required
inputs:
workflow_run_id:
description: 'Workflow run ID to retry'
required: true
type: string
permissions:
actions: write # Required to modify/rerun workflows
contents: read
jobs:
rerun-on-failure:
if: ${{ (github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt == 1) || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Retry failed workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.event.workflow_run.id || github.event.inputs.workflow_run_id }}
run: |
echo "Retrying workflow run: $RUN_ID"
sleep 30
gh run rerun $RUN_ID --failed --repo $REPO