From 8806abda6cd964081245353d0e760ddc669f23e2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 7 Feb 2026 22:48:01 +0100 Subject: [PATCH] refactor(workflow): do not clean cache after run (#9155) Co-authored-by: mahula --- .../workflows/cleanup-cache-at-pr-closing.yml | 42 ------------------- .github/workflows/test-backend.yml | 17 -------- .github/workflows/test-e2e.yml | 21 ---------- .github/workflows/test-webapp.yml | 17 -------- 4 files changed, 97 deletions(-) delete mode 100644 .github/workflows/cleanup-cache-at-pr-closing.yml diff --git a/.github/workflows/cleanup-cache-at-pr-closing.yml b/.github/workflows/cleanup-cache-at-pr-closing.yml deleted file mode 100644 index aa3f48b09..000000000 --- a/.github/workflows/cleanup-cache-at-pr-closing.yml +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################### -# A Github repo has max 10 GB of cache. -# https://github.blog/changelog/2021-11-23-github-actions-cache-size-is-now-increased-to-10gb-per-repository/ -# -# To avoid "cache thrashing" by their cache eviction policy it is recommended -# to apply a cache cleanup workflow at PR closing to dele cache leftovers of -# the current branch: -# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries -############################################################################### - -name: ocelot.social cache cleanup on pr closing - -on: - pull_request: - types: - - closed - -jobs: - clean-branch-cache: - name: Cleanup branch cache - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.7 - - - name: Cleanup - run: | - gh extension install actions/gh-actions-cache - REPO=${{ github.repository }} - BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" - echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - done - echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-backend.yml b/.github/workflows/test-backend.yml index 3a9519f1b..905f4b1d1 100644 --- a/.github/workflows/test-backend.yml +++ b/.github/workflows/test-backend.yml @@ -127,20 +127,3 @@ jobs: - name: backend | Unit test incl. coverage check run: docker compose exec -T backend yarn test - cleanup: - name: Cleanup - if: ${{ needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.docker == 'true' }} - needs: [files-changed, unit_test_backend] - runs-on: ubuntu-latest - permissions: write-all - continue-on-error: true - steps: - - name: Delete cache - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh extension install actions/gh-actions-cache - KEY="${{ github.run_id }}-backend-neo4j-cache" - gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm - KEY="${{ github.run_id }}-backend-cache" - gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index ef18ce491..84c6212c5 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -187,24 +187,3 @@ jobs: name: ocelot-e2e-test-report-pr${{ needs.docker_preparation.outputs.pr-number }} path: /home/runner/work/Ocelot-Social/Ocelot-Social/cypress/reports/cucumber_html_report - cleanup_cache: - name: Cleanup Cache - needs: fullstack_tests - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.2.2 - - - name: Full stack tests | cleanup cache - run: | - cacheKeys=$(gh cache list --json key --jq '.[] | select(.key | startswith("${{ github.run_id }}-e2e-")) | .key') - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeys - do - gh cache delete "$cacheKey" - done - echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-webapp.yml b/.github/workflows/test-webapp.yml index 3e1430ad6..606916880 100644 --- a/.github/workflows/test-webapp.yml +++ b/.github/workflows/test-webapp.yml @@ -108,20 +108,3 @@ jobs: - name: webapp | Unit tests incl. coverage check run: docker compose exec -T webapp yarn test - - cleanup: - name: Cleanup - if: ${{ needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true' }} - needs: [files-changed, unit_test_webapp] - runs-on: ubuntu-latest - permissions: write-all - continue-on-error: true - steps: - - name: Delete cache - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh extension install actions/gh-actions-cache - KEY="${{ github.run_id }}-webapp-cache" - gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm -