From b86473df027f691dd31ff35f57051ea667b11c03 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Tue, 21 Apr 2026 20:36:28 +0200 Subject: [PATCH] Run cache cleanup daily and reduce cutoff to 1 day --- .github/workflows/cleanup_caches.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cleanup_caches.yml b/.github/workflows/cleanup_caches.yml index dcf50fce..b7d8fc1a 100644 --- a/.github/workflows/cleanup_caches.yml +++ b/.github/workflows/cleanup_caches.yml @@ -1,7 +1,7 @@ name: Cleanup Caches on: schedule: - - cron: '0 3 * * 0' # every Sunday + - cron: "0 3 * * *" # every day workflow_dispatch: jobs: @@ -10,16 +10,16 @@ jobs: permissions: actions: write steps: - - name: Delete caches older than 3 days + - name: Delete caches older than 1 day env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - CUTOFF_DATE=$(date -d "3 days ago" -Ins --utc | sed 's/+0000/Z/') + CUTOFF_DATE=$(date -d "1 days ago" -Ins --utc | sed 's/+0000/Z/') echo "Deleting caches older than: $CUTOFF_DATE" - + CACHE_IDS=$(gh api --paginate repos/${{ github.repository }}/actions/caches \ --jq ".actions_caches[] | select(.last_accessed_at < \"$CUTOFF_DATE\") | .id" 2>/dev/null) - + if [ -z "$CACHE_IDS" ]; then echo "No old caches found to delete." else @@ -28,4 +28,4 @@ jobs: gh api -X DELETE repos/${{ github.repository }}/actions/caches/$CACHE_ID done echo "Old caches deleted successfully." - fi \ No newline at end of file + fi