Skip to content

Commit fa612f9

Browse files
authored
gh-actions/cache/restore: Fix conditions for cache type selection (#2988)
Signed-off-by: Ryan Northey <[email protected]>
1 parent ddb47b7 commit fa612f9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

gh-actions/cache/restore/action.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ inputs:
88
artifact-wf-path:
99
type: string
1010
default:
11+
cache-type:
12+
type: string
13+
default: github
14+
description: |
15+
Cache type, should be one of "github", "gcs", "artifact"
1116
key:
1217
type: string
1318
required: true
@@ -36,6 +41,7 @@ inputs:
3641
type: boolean
3742
default: false
3843

44+
3945
runs:
4046
using: "composite"
4147
steps:
@@ -56,23 +62,24 @@ runs:
5662
# Restore cache
5763
- name: Restore cache
5864
if: >-
59-
! inputs.gcs-bucket
60-
&& ! inputs.artifact-name
65+
inputs.cache-type == 'github'
6166
id: cache-restore
6267
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
6368
with:
6469
path: ${{ inputs.path || inputs.path-tmp }}
6570
key: ${{ inputs.key }}
6671
- name: Restore GCS cache
67-
if: inputs.gcs-bucket
72+
if: >-
73+
inputs.cache-type == 'gcs'
6874
id: cache-restore-gcs
6975
uses: envoyproxy/toolshed/gh-actions/gcs/cache/[email protected]
7076
with:
7177
bucket: ${{ inputs.gcs-bucket }}
7278
path: ${{ inputs.path || inputs.path-tmp }}
7379
key: ${{ inputs.key }}
7480
- name: Restore artifact cache
75-
if: inputs.artifact-name
81+
if: >-
82+
inputs.cache-type == 'artifact'
7683
id: cache-restore-artifact
7784
uses: envoyproxy/toolshed/gh-actions/github/artifact/cache/[email protected]
7885
with:

0 commit comments

Comments
 (0)