-
Notifications
You must be signed in to change notification settings - Fork 0
34 lines (29 loc) · 976 Bytes
/
rerun.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
name: Rerun workflow
on:
workflow_dispatch:
inputs:
runId:
description: "RUN_ID of the failed workflow run to be rerunned"
required: true
type: string
env:
runId: ${{ github.event.inputs.runId }}
jobs:
retry_workflow_job:
name: Rerun ${{ github.event.inputs.runId }}
runs-on: ubuntu-latest
steps:
- name: "Rerun ${{ github.event.inputs.runId }}"
shell: pwsh
env:
# GITHUB_TOKEN with actions: write will NOT work
# PAT Token must have workflow scope
RERUN_TOKEN: ${{ secrets.RERUN_TOKEN_CLASSIC }}
run: |
echo "Running gh auth login..."
$env:RERUN_TOKEN | gh auth login --with-token
if(!$?) { exit 1 }
echo "Retrying run..."
echo "gh run rerun $env:runId --failed --repo $env:GITHUB_REPOSITORY"
gh run rerun $env:runId --failed --repo $env:GITHUB_REPOSITORY
if(!$?) { exit 1 }