Retry failed PR jobs once #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Retry failed PR jobs once | |
| on: | |
| workflow_run: | |
| workflows: | |
| - "CI" | |
| - "E2E Fleet" | |
| - "E2E Upgrade Fleet Standalone to HEAD" | |
| - "E2E Multi-Cluster Fleet" | |
| types: [completed] | |
| permissions: | |
| actions: write | |
| jobs: | |
| retry: | |
| # Only retry once, only on pull_request runs, only on failure. | |
| # Skipped runs (e.g. path filters) have conclusion 'skipped', not 'failure'. | |
| if: >- | |
| github.event.workflow_run.conclusion == 'failure' && | |
| github.event.workflow_run.run_attempt == 1 && | |
| github.event.workflow_run.event == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Rerun failed jobs | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RUN_ID: ${{ github.event.workflow_run.id }} | |
| run: | | |
| gh api \ | |
| --method POST \ | |
| "repos/${{ github.repository }}/actions/runs/$RUN_ID/rerun-failed-jobs" |