Skip to content

Commit b86e674

Browse files
test
1 parent 19c4669 commit b86e674

File tree

1 file changed

+50
-51
lines changed

1 file changed

+50
-51
lines changed
Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
---
2-
name: Workflow Restarter
3-
on:
4-
workflow_dispatch:
5-
inputs:
6-
repo:
7-
description: "GitHub repository name."
8-
required: true
9-
type: string
10-
run_id:
11-
description: "The ID of the workflow run to rerun."
12-
required: true
13-
type: string
14-
retries:
15-
description: "The number of times to retry the workflow run."
16-
required: false
17-
type: number
18-
default: 3
19-
secrets:
20-
GITHUB_TOKEN:
21-
required: true
22-
23-
jobs:
24-
rerun:
25-
runs-on: ubuntu-latest
26-
steps:
27-
- name: Checkout code
28-
uses: actions/checkout@v4
29-
30-
- name: Check retry count
31-
id: check-retry
32-
run: |
33-
# IF `--attempts` returns a non-zero exit code, then keep retrying
34-
status_code=$(gh run view ${{ inputs.run_id }} --repo ${{ inputs.repo }} --attempt ${{ inputs.retries }} --json status) || {
35-
echo "Retry count is within limit"
36-
echo "::set-output name=should_retry::true"
37-
exit 0
38-
}
39-
40-
# ELSE `--attempts` returns a zero exit code, so stop retrying
41-
echo "Retry count has reached the limit"
42-
echo "::set-output name=should_retry::false"
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45-
46-
- name: Re-run failed jobs
47-
if: ${{ steps.check-retry.outputs.should_retry == 'true' }}
48-
run: gh run rerun --failed ${{ inputs.run_id }} --repo ${{ inputs.repo }}
49-
continue-on-error: true
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52-
2+
name: Workflow Restarter
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
repo:
7+
description: "GitHub repository name."
8+
required: true
9+
type: string
10+
run_id:
11+
description: "The ID of the workflow run to rerun."
12+
required: true
13+
type: string
14+
retries:
15+
description: "The number of times to retry the workflow run."
16+
required: false
17+
type: number
18+
default: 3
19+
secrets:
20+
GITHUB_TOKEN:
21+
required: true
22+
23+
jobs:
24+
rerun:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
30+
- name: Check retry count
31+
id: check-retry
32+
run: |
33+
# IF `--attempts` returns a non-zero exit code, then keep retrying
34+
status_code=$(gh run view ${{ inputs.run_id }} --repo ${{ inputs.repo }} --attempt ${{ inputs.retries }} --json status) || {
35+
echo "Retry count is within limit"
36+
echo "::set-output name=should_retry::true"
37+
exit 0
38+
}
39+
40+
# ELSE `--attempts` returns a zero exit code, so stop retrying
41+
echo "Retry count has reached the limit"
42+
echo "::set-output name=should_retry::false"
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Re-run failed jobs
47+
if: ${{ steps.check-retry.outputs.should_retry == 'true' }}
48+
run: gh run rerun --failed ${{ inputs.run_id }} --repo ${{ inputs.repo }}
49+
continue-on-error: true
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)