name: Auto-Retry on Timeout on: workflow_run: workflows: ["Deploy to Cloudflare Pages"] types: [completed] jobs: retry-job: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled' }} permissions: actions: write contents: read steps: - name: Relancer le workflow (Retry) if: ${{ github.event.workflow_run.run_attempt < 3 }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | echo "Previous run failed. Attempting rerun #${{ github.event.workflow_run.run_attempt }}..." # Use 'run rerun' to increment the attempt counter properly # Add --repo to fix the "not a git repository" error gh run rerun ${{ github.event.workflow_run.id }} \ --repo ${{ github.repository }} \ --failed - name: Stop Retrying if: ${{ github.event.workflow_run.run_attempt >= 3 }} run: echo "Max attempts reached (3). Stopping to prevent loop."