blog_tech/.github/workflows/auto-retry.yml

26 lines
No EOL
974 B
YAML

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."