1
1
#
2
- # This action recreate action for building stable images
2
+ # This action restarts actions that failed - 3x
3
3
#
4
4
name : Watchdog (cronjob)
5
5
on :
8
8
- cron : ' */15 * * * *'
9
9
workflow_dispatch :
10
10
11
- env :
12
- GH_TOKEN : ${{ secrets.ACCESS_TOKEN_ARMBIANWORKER }}
13
-
14
11
concurrency :
15
12
group : watchdog-${{ github.ref }}
16
13
cancel-in-progress : true
@@ -24,10 +21,12 @@ jobs:
24
21
matrix :
25
22
26
23
# list scripts you want to watch and execute failed jobs x-times
27
- script : ["generate-redirector-config","generate-base-files-info-json"]
24
+ script :
25
+ - generate-redirector-config
26
+ - generate-base-files-info-json
28
27
29
- name : rerun
30
- runs-on : ubuntu-latest
28
+ name : " R "
29
+ runs-on : ubuntu-24.04
31
30
steps :
32
31
33
32
- name : " Restart ${{ matrix.script }}.yml"
@@ -38,10 +37,10 @@ jobs:
38
37
ATTEMPTS="3"
39
38
SCRIPT="${{ matrix.script }}"
40
39
41
- WORKFLOW=$(gh api "/repos/${OWNER_REPO }/actions/workflows" | jq '.workflows[] | select(.path==".github/workflows/'${{ matrix.script }}'.yml")' | jq -r '.id')
42
- read ID STATUS ATTEMPT <<< $(gh api "/repos/${OWNER_REPO }/actions/workflows/${WORKFLOW}/runs" | jq '.workflow_runs[]' | jq -r '.id,.conclusion,.run_attempt' | head -3 | xargs -n3 -d'\n')
40
+ WORKFLOW=$(gh api "/repos/${{ github.repository } }/actions/workflows" | jq '.workflows[] | select(.path==".github/workflows/'${{ matrix.script }}'.yml")' | jq -r '.id')
41
+ read ID STATUS ATTEMPT <<< $(gh api "/repos/${{ github.repository } }/actions/workflows/${WORKFLOW}/runs" | jq '.workflow_runs[]' | jq -r '.id,.conclusion,.run_attempt' | head -3 | xargs -n3 -d'\n')
43
42
44
43
# if attempt is lower then 5 and status is "cancelled" or "failed", rerun failed jobs
45
44
if [ "${ATTEMPT}" -lt "${ATTEMPTS}" ] && ([ "$STATUS" == "failure" ] || [ "$STATUS" == "failure" ]); then
46
- gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${OWNER_REPO }/actions/runs/${ID}/rerun-failed-jobs
45
+ gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{ github.repository } }/actions/runs/${ID}/rerun-failed-jobs
47
46
fi
0 commit comments