From b94a3d9f2f8853ca4d5112635d92b94bae49e411 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 2 Mar 2025 01:16:42 -0800 Subject: [PATCH] Do not store cache on pull request --- .github/actions/setup/action.yml | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 1235d016a..84d87da77 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -26,6 +26,15 @@ runs: - name: Cache sccache uses: actions/cache@v4 + if: ${{ github.event_name != 'pull_request' }} + with: + path: .sccache + key: sccache-${{ runner.os }}-${{ github.sha }} + restore-keys: sccache-${{ runner.os }}- + + - name: Restore sccache + uses: actions/cache/restore@v4 + if: ${{ github.event_name == 'pull_request' }} with: path: .sccache key: sccache-${{ runner.os }}-${{ github.sha }} @@ -55,7 +64,7 @@ runs: - name: Cache Gradle dependencies uses: actions/cache@v4 - if: inputs.is-asset-build == 'true' + if: inputs.is-asset-build == 'true' && ${{ github.event_name != 'pull_request' }} with: path: | .gradle/caches @@ -66,7 +75,7 @@ runs: - name: Restore Gradle dependencies uses: actions/cache/restore@v4 - if: inputs.is-asset-build == 'false' + if: inputs.is-asset-build == 'false' || ${{ github.event_name == 'pull_request' }} with: path: | .gradle/caches @@ -78,19 +87,17 @@ runs: - name: Cache Gradle build cache uses: actions/cache@v4 - if: inputs.is-asset-build == 'true' + if: inputs.is-asset-build == 'true' && ${{ github.event_name != 'pull_request' }} with: - path: | - .gradle/caches/build-cache-* + path: .gradle/caches/build-cache-* key: gradle-build-cache-${{ github.sha }} restore-keys: gradle-build-cache- - name: Restore Gradle build cache uses: actions/cache/restore@v4 - if: inputs.is-asset-build == 'false' + if: inputs.is-asset-build == 'false' || ${{ github.event_name == 'pull_request' }} with: - path: | - .gradle/caches/build-cache-* + path: .gradle/caches/build-cache-* key: gradle-build-cache-${{ github.sha }} restore-keys: gradle-build-cache- enableCrossOsArchive: true