diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index f6c269978..af8de1b7a 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -35,7 +35,8 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || github.ref_name }} + # either the PR number or `branch-N` where N always increments + CACHE_KEY: linux-build-test-cpp-asserts-manylinux-v2-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -104,6 +105,7 @@ jobs: # required to run gh with privileges GH_TOKEN: ${{ github.token }} run: | + ccache -sv gh extension install actions/gh-actions-cache gh actions-cache delete ${{ env.CACHE_KEY }} --confirm -R ${{ github.repository }} diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index a94d84b69..24393e676 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -30,7 +30,7 @@ jobs: runs-on: [macos-12, macos-14] env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }} + CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -94,6 +94,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + ccache -sv gh extension install actions/gh-actions-cache gh actions-cache delete ${{ env.CACHE_KEY }} --confirm -R ${{ github.repository }} diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 07e5e3248..ff7914aa7 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -33,7 +33,7 @@ jobs: fail-fast: true env: CACHE_DIR: ${{ github.workspace }}/.container-cache - CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || github.ref_name }} + CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} steps: - name: Set unified TZ uses: szenius/set-timezone@v2.0 @@ -100,6 +100,7 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + ccache -sv gh extension install actions/gh-actions-cache gh actions-cache delete ${{ env.CACHE_KEY }} --confirm -R ${{ github.repository }}