Auto Retry Failed Jobs #6
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: Auto Retry Failed Jobs | |
| # This is to handle the case where the oc-login setup action fails due to intermittent network blocks (reputation issues on the IP). | |
| #The workflow will re-run the failed jobs up to 3 times. | |
| on: | |
| workflow_run: | |
| workflows: | |
| - "1. Build & Deploy to Dev" | |
| - "2. Create Tag & Build/Deploy to Test" | |
| - "3. Create Tag & Build/Deploy to UAT" | |
| types: [completed] | |
| jobs: | |
| retry-failed-job: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.run_attempt < 3 }} | |
| permissions: | |
| actions: write | |
| steps: | |
| - name: Re-run failed jobs | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RUN_ID: ${{ github.event.workflow_run.id }} | |
| run: | | |
| gh run rerun $RUN_ID --failed |