Skip to content

Commit

Permalink
Automatically re-run failed jobs (#2795)
Browse files Browse the repository at this point in the history
Some CI jobs are a bit flaky, without an obvious way for us to fix them.
Instead, I've added a new job that checks if any job failed, and re-runs
them automatically.
  • Loading branch information
Mrtenz authored Oct 4, 2024
1 parent 82ee203 commit 97144bf
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,15 @@ jobs:
if [[ $passed != "true" ]]; then
exit 1
fi
re-run:
name: Re-run failed jobs
needs: lint-build-test
if: failure() && fromJSON(github.run_attempt) < 3
runs-on: ubuntu-latest
steps:
- env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: gh workflow run re-run.yml -F run-id=${{ github.run_id }}
18 changes: 18 additions & 0 deletions .github/workflows/re-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
workflow_dispatch:
inputs:
run-id:
required: true

jobs:
rerun:
runs-on: ubuntu-latest
steps:
- name: rerun ${{ inputs.run-id }}
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GH_DEBUG: api
run: |
gh run watch ${{ inputs.run-id }} > /dev/null 2>&1
gh run rerun ${{ inputs.run-id }} --failed

0 comments on commit 97144bf

Please sign in to comment.