(fix): cleanup workflow
This commit is contained in:
parent
123c0c831e
commit
5ff85002fd
1 changed files with 6 additions and 5 deletions
|
|
@ -31,17 +31,18 @@ jobs:
|
||||||
"$API/repos/$REPO/actions/runs?page=$PAGE&limit=50" \
|
"$API/repos/$REPO/actions/runs?page=$PAGE&limit=50" \
|
||||||
-o runs.json
|
-o runs.json
|
||||||
|
|
||||||
COUNT="$(jq '.workflow_runs | length' runs.json)"
|
COUNT="$(jq 'if type == "array" then length else (.workflow_runs // []) | length end' runs.json)"
|
||||||
test "$COUNT" -gt 0 || break
|
test "$COUNT" -gt 0 || break
|
||||||
|
|
||||||
jq -r \
|
jq -r \
|
||||||
--arg cutoff "$CUTOFF" \
|
--arg cutoff "$CUTOFF" \
|
||||||
--arg current "$CURRENT_RUN_ID" \
|
--arg current "$CURRENT_RUN_ID" \
|
||||||
'.workflow_runs[]
|
'if type == "array" then . else (.workflow_runs // []) end
|
||||||
|
| .[]
|
||||||
|
| select(type == "object")
|
||||||
| select((.id | tostring) != $current)
|
| select((.id | tostring) != $current)
|
||||||
| .status as $status
|
| select((.status // .conclusion) as $status | ["success", "failure", "cancelled", "skipped", "succeeded", "failed"] | index($status))
|
||||||
| select(["success", "failure", "cancelled", "skipped", "succeeded", "failed"] | index($status))
|
| select((.created // .created_at) < $cutoff)
|
||||||
| select(.created < $cutoff)
|
|
||||||
| .id' runs.json \
|
| .id' runs.json \
|
||||||
>> "$DELETE_IDS"
|
>> "$DELETE_IDS"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue