fix(release): 清理范围补 cancelled——取消的 run 同样是无效记录
sdk-ci / test (push) Successful in 2m14s

This commit is contained in:
iceking2nd committed 2026-11-10 10:47:08 +08:00
1 parent 7bfd44b588
commit d5e3b4324a
1 file changed
+1 -1
+1 -1
View File
@@ -56,7 +56,7 @@ jobs:
while :; do while :; do
RUNS=$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" "${API}/repos/${REPO}/actions/tasks?limit=50&page=${PAGE}") RUNS=$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" "${API}/repos/${REPO}/actions/tasks?limit=50&page=${PAGE}")
TOTAL=$(echo "${RUNS}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('total_count',0))") TOTAL=$(echo "${RUNS}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('total_count',0))")
echo "${RUNS}" | python3 -c "import json,sys; [print(r['url']) for r in json.load(sys.stdin).get('workflow_runs',[]) if r.get('status')=='failure']" | while read -r url; do echo "${RUNS}" | python3 -c "import json,sys; [print(r['url']) for r in json.load(sys.stdin).get('workflow_runs',[]) if r.get('status') in ('failure','cancelled')]" | while read -r url; do
RUN_API=$(echo "${url}" | sed "s|${GITHUB_SERVER_URL}/\\(.*\\)/actions/runs/|${API}/repos/\\1/actions/runs/|") RUN_API=$(echo "${url}" | sed "s|${GITHUB_SERVER_URL}/\\(.*\\)/actions/runs/|${API}/repos/\\1/actions/runs/|")
echo "删除失败 run: ${url}" echo "删除失败 run: ${url}"
curl -sS -o /dev/null -X DELETE -H "Authorization: token ${GITEA_TOKEN}" "${RUN_API}" curl -sS -o /dev/null -X DELETE -H "Authorization: token ${GITEA_TOKEN}" "${RUN_API}"