-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
43 lines (39 loc) · 1.14 KB
/
rerun-failed.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Rerun Workflows
on:
workflow_dispatch:
inputs:
runId:
description: 'The ID of workflow to rerun'
required: true
type: string
rerunFailedOnly:
description: 'Rerun only failed jobs'
required: false
type: boolean
default: true
permissions: write-all
env:
GH_CLI_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_ID: ${{ github.event.inputs.runId }}
RERUN_FAILED_ONLY: ${{ github.event.inputs.rerunFailedOnly }}
jobs:
rerun_workflow:
name: Rerun ${{ github.event.inputs.runId }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Install GitHub CLI
run: |
sudo apt update
sudo apt install gh
- name: Authenticate GitHub CLI
run: |
echo "${GH_CLI_TOKEN}" | gh auth login --with-token
- name: "Rerun workflow ${{ env.RUN_ID }}"
run: |
if [ "${RERUN_FAILED_ONLY}" = "true" ]; then
gh run rerun ${RUN_ID} --failed --repo ${GITHUB_REPOSITORY}
else
gh run rerun ${RUN_ID} --repo ${GITHUB_REPOSITORY}
fi