From 911a44eef4abd4a916add8198c43bf60b8714c08 Mon Sep 17 00:00:00 2001 From: "rE-Bo0t.bx1" <54429050+r3bo0tbx1@users.noreply.github.com> Date: Fri, 5 Dec 2025 20:48:52 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20feat(ci):=20add=20scheduled=20ca?= =?UTF-8?q?che=20cleanup=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cleanup.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 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 0000000..c444683 --- /dev/null +++ b/.github/workflows/cleanup.yml @@ -0,0 +1,34 @@ +name: ๐Ÿ—‘๏ธ๐Ÿงน + +on: + schedule: + - cron: '0 0 * * 0' + workflow_dispatch: + +permissions: + actions: write + +jobs: + clear-cache: + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ—‘๏ธ Clear GitHub Actions Cache + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + run: | + echo "๐Ÿ” Fetching list of caches..." + # Get all cache keys + cacheKeys=$(gh cache list --limit 100 --repo $REPO --json key --jq '.[].key') + + if [ -z "$cacheKeys" ]; then + echo "โœ… No caches found to clear." + exit 0 + fi + + echo "๐Ÿ—‘๏ธ Deleting caches..." + for key in $cacheKeys; do + echo " - Deleting $key" + gh cache delete "$key" --repo $REPO || echo " โš ๏ธ Failed to delete $key (might already be gone)" + done + echo "๐ŸŽ‰ Cache cleanup complete." \ No newline at end of file