From 177bc6f876f1f98bd5a36408af591d7018443555 Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Sat, 27 Jun 2026 19:42:53 +0800 Subject: [PATCH] Create cleanup.yml --- .github/workflows/cleanup.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/cleanup.yml diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml new file mode 100644 index 00000000..ef5657fb --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,25 @@ +name: Cleanup Artifacts + +on: + workflow_dispatch: + +jobs: + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + steps: + - name: Delete all artifacts + run: | + # 安装 gh cli + gh extension install actions/gh-actions-cache || true + + # 删除所有 artifacts + echo "正在删除所有 artifacts..." + for artifact in $(gh api repos/${{ github.repository }}/actions/artifacts --paginate | jq -r '.artifacts[].id'); do + echo "删除 artifact: $artifact" + gh api -X DELETE repos/${{ github.repository }}/actions/artifacts/$artifact || true + done + + echo "✅ 清理完成!"