From 71711bb9356b8643ca499ae9dbb75451ed21554e Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 21 May 2024 19:46:17 +0200 Subject: [PATCH] ci: Prevent caching cabal and stack cache in PRs This was supposed to happen in c4b0bd34 and 279febe2, but somehow didn't work, yet. --- .github/actions/cache-on-main/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/cache-on-main/action.yaml b/.github/actions/cache-on-main/action.yaml index a7dc0a94e..181ab6cfa 100644 --- a/.github/actions/cache-on-main/action.yaml +++ b/.github/actions/cache-on-main/action.yaml @@ -8,7 +8,7 @@ inputs: required: true save-prs: description: Whether to additionally store the cache in a pull request, too. Should only be used for very small caches. - default: false + type: boolean prefix: description: Cache key prefix to be used in both primary key and restore-keys. required: true @@ -20,14 +20,14 @@ runs: using: composite steps: - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - if: ${{ startsWith(github.ref, 'refs/heads/') || (inputs.save-prs && github.head_ref) }} + if: ${{ startsWith(github.ref, 'refs/heads/') || (inputs.save-prs && startsWith(github.ref, 'refs/pull/')) }} with: path: ${{ inputs.path }} key: ${{ runner.os }}-${{ inputs.prefix }}-${{ inputs.suffix }} restore-keys: | ${{ runner.os }}-${{ inputs.prefix }}- - uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - if: ${{ !startsWith(github.ref, 'refs/heads/') && !(inputs.save-prs && github.head_ref) }} + if: ${{ !startsWith(github.ref, 'refs/heads/') && !(inputs.save-prs && startsWith(github.ref, 'refs/pull/')) }} with: path: ${{ inputs.path }} key: ${{ runner.os }}-${{ inputs.prefix }}-${{ inputs.suffix }}