Update cleanup.yml
This commit is contained in:
1 parent
649caf0e17
commit
045c2f211e
1 file changed
+23
-5
@@ -1,4 +1,4 @@
|
||||
name: Cleanup Artifacts
|
||||
name: Cleanup Artifacts and Cache
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -12,16 +12,34 @@ jobs:
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
steps:
|
||||
- name: Delete all artifacts
|
||||
- name: Setup GitHub CLI
|
||||
run: |
|
||||
# 安装 gh cli
|
||||
gh extension install actions/gh-actions-cache || true
|
||||
|
||||
# 删除所有 artifacts
|
||||
echo "正在删除所有 artifacts..."
|
||||
- name: Delete all artifacts
|
||||
run: |
|
||||
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 "✅ Artifacts 清理完成!"
|
||||
|
||||
- name: Delete all caches
|
||||
run: |
|
||||
echo "🗑️ 正在删除所有 caches..."
|
||||
for cache in $(gh api repos/${{ github.repository }}/actions/caches --paginate | jq -r '.actions_caches[].id'); do
|
||||
echo "删除 cache: $cache"
|
||||
gh api -X DELETE repos/${{ github.repository }}/actions/caches/$cache || true
|
||||
done
|
||||
echo "✅ Caches 清理完成!"
|
||||
|
||||
- name: Verify cleanup
|
||||
run: |
|
||||
echo "📊 当前存储状态:"
|
||||
echo "Artifacts:"
|
||||
gh api repos/${{ github.repository }}/actions/artifacts --paginate | jq -r '.artifacts | length' | xargs -I {} echo " - {} 个 artifacts"
|
||||
echo "Caches:"
|
||||
gh api repos/${{ github.repository }}/actions/caches --paginate | jq -r '.actions_caches | length' | xargs -I {} echo " - {} 个 caches"
|
||||
echo ""
|
||||
echo "✅ 清理完成!"
|
||||
Reference in new issue
Block a user