26 lines
689 B
YAML
26 lines
689 B
YAML
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 "✅ 清理完成!"
|