diff --git a/.github/workflows/auto-retry.yml b/.github/workflows/auto-retry.yml new file mode 100644 index 0000000..2e75a78 --- /dev/null +++ b/.github/workflows/auto-retry.yml @@ -0,0 +1,26 @@ +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 + + steps: + - name: Relancer le workflow si moins de 3 essais + if: ${{ github.event.workflow_run.run_attempt < 3 }} + run: | + echo "Le workflow précédent a échoué ou a duré trop longtemps. Relance automatique..." + gh workflow run "${{ github.event.workflow_run.workflow_id }}" --ref "${{ github.event.workflow_run.head_branch }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Ne pas relancer (Trop d'essais) + if: ${{ github.event.workflow_run.run_attempt >= 3 }} + run: echo "Déjà 3 tentatives échouées. On arrête pour éviter une boucle infinie." \ No newline at end of file