File tree Expand file tree Collapse file tree 1 file changed +9
-34
lines changed Expand file tree Collapse file tree 1 file changed +9
-34
lines changed Original file line number Diff line number Diff line change 1- ---
1+ # target-repo/.github/workflows/call-reusable-workflow.yml
22name : Workflow Restarter
33on :
44 workflow_dispatch :
1414 retries :
1515 description : " The number of times to retry the workflow run."
1616 required : false
17- type : number
18- default : 3
19- secrets :
20- GITHUB_TOKEN :
21- required : true
17+ type : string
18+ default : " 3"
2219
2320jobs :
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 }}
21+ call-reusable-workflow :
22+ uses : puppetlabs/cat-github-actions/.github/workflows/workflow-restarter.yml@cat_1820
23+ with :
24+ repo : ${{ inputs.repo }}
25+ run_id : ${{ inputs.run_id }}
26+ retries : ${{ inputs.retries }}
You can’t perform that action at this time.
0 commit comments