ci: Prevent caching cabal and stack cache in PRs

This was supposed to happen in c4b0bd34 and 279febe2, but somehow didn't
work, yet.
This commit is contained in:
Wolfgang Walther
2024-05-21 20:44:41 +02:00
committed by Wolfgang Walther
parent ad5bb38d70
commit 71711bb935
+3 -3
View File
@@ -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 }}