Create cleanup.yml
This commit is contained in:
1 parent
650c84064f
commit
177bc6f876
1 file changed
+25
@@ -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 "✅ 清理完成!"
|
||||||
Reference in new issue
Block a user