Skip to content

Commit 40c5a3d

Browse files
gtwang01facebook-github-bot
authored andcommitted
Auto-retry failed CI builds once (facebookresearch#3718)
Summary: Pull Request resolved: facebookresearch#3718 As title Differential Revision: D60697701
1 parent 0b2328f commit 40c5a3d

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/build.yml

+16
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,19 @@ jobs:
262262
- uses: ./.github/actions/build_conda
263263
with:
264264
label: main
265+
re-run:
266+
name: Activate rerun workflow
267+
if: fromJSON(github.run_attempt) < 2
268+
runs-on: ubuntu-latest
269+
env:
270+
GH_CLI_TOKEN: ${{ secrets.PAT_TOKEN }}
271+
steps:
272+
- name:
273+
run: |
274+
$env:GH_CLI_TOKEN | gh auth login --with-token
275+
if(!$?) { exit 1 }
276+
277+
gh workflow run retry_build.yml `
278+
--raw-field run_id=${{ github.run_id }} `
279+
--repo ${{ github.repository }}
280+
if(!$?) { exit 1 }

.github/workflows/retry_build.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Retry Build
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
run_id:
6+
required: true
7+
jobs:
8+
rerun-on-failure:
9+
runs-on: ubuntu-latest
10+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
11+
steps:
12+
- name: rerun ${{ inputs.run_id }}
13+
env:
14+
GH_REPO: ${{ github.repository }}
15+
GH_TOKEN: ${{ github.token }}
16+
GH_DEBUG: api
17+
run: |
18+
gh run watch ${{ inputs.run_id }} > /dev/null 2>&1
19+
gh run rerun ${{ inputs.run_id }} --failed

0 commit comments

Comments
 (0)