(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" \
|
||||
-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
|
||||
|
||||
jq -r \
|
||||
--arg cutoff "$CUTOFF" \
|
||||
--arg current "$CURRENT_RUN_ID" \
|
||||
'.workflow_runs[]
|
||||
'if type == "array" then . else (.workflow_runs // []) end
|
||||
| .[]
|
||||
| select(type == "object")
|
||||
| select((.id | tostring) != $current)
|
||||
| .status as $status
|
||||
| select(["success", "failure", "cancelled", "skipped", "succeeded", "failed"] | index($status))
|
||||
| select(.created < $cutoff)
|
||||
| select((.status // .conclusion) as $status | ["success", "failure", "cancelled", "skipped", "succeeded", "failed"] | index($status))
|
||||
| select((.created // .created_at) < $cutoff)
|
||||
| .id' runs.json \
|
||||
>> "$DELETE_IDS"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue