Auto-rerun failed CI jobs #25
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-rerun failed CI jobs | |
| # See PR #659: exit-143 SIGTERM crashes in MPI-using jobs correlate with | |
| # specific Azure regions (centralus/northcentralus/westcentralus/westus3), | |
| # not with any package version or OS image, and persist for the life of a | |
| # runner - retrying a command in-place doesn't help when the problem is | |
| # the runner itself (confirmed: two in-place retry attempts in the same | |
| # job both failed identically). A fresh job attempt gets assigned a new | |
| # runner and a new shot at a healthy region. | |
| # | |
| # This has to be a separate workflow_run-triggered workflow rather than a | |
| # job inside ci_pipeline.yml: GitHub refuses `gh run rerun` while the | |
| # target run still has an active job ("This workflow is already running"), | |
| # and a job calling it from within its own run can never observe that run | |
| # as anything but in-progress. workflow_run only fires once the run has | |
| # genuinely finished. | |
| on: | |
| workflow_run: | |
| workflows: ["CI pipeline for pySDC"] | |
| types: ["completed"] | |
| jobs: | |
| rerun-failed-jobs: | |
| runs-on: ubuntu-latest | |
| if: >- | |
| ${{ github.repository_owner == 'Parallel-in-Time' | |
| && github.event.workflow_run.conclusion == 'failure' | |
| && github.event.workflow_run.run_attempt < 3 }} | |
| permissions: | |
| actions: write | |
| steps: | |
| - name: Rerun failed jobs in a new attempt | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh run rerun ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} --failed |