diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f0f670b58..3227017bd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} diff --git a/.github/workflows/re-run.yml b/.github/workflows/re-run.yml new file mode 100644 index 0000000000..322173640e --- /dev/null +++ b/.github/workflows/re-run.yml @@ -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