-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
22 lines (22 loc) · 1.14 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
name: 'Rerun Workflows'
description: 'Used to automatically rerun workflows if they were cancelled. Used to help the issue with concurrency.'
branding:
icon: 'repeat'
color: 'green'
inputs:
auth-token:
description: 'If you are working in a private repo, you will need to specify the [GitHub secrets token](https://docs.github.com/en/actions/reference/authentication-in-a-workflow)'
default: ${{ github.token }}
required: false
runs:
using: "composite"
steps:
- env:
AUTH_TOKEN: ${{ inputs.auth-token }}
REPO_NAME: ${{ github.event.repository.full_name }}
run: |
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${AUTH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/"$REPO_NAME"/actions/runs?status=cancelled | jq --raw-output '.workflow_runs[] | select(.conclusion == "cancelled") .rerun_url' >> rerun-urls.txt
while read -r rerun_urls; do
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${AUTH_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" "${rerun_urls}"
done < rerun-urls.txt
shell: bash