Skip to content

Commit 221d95d

Browse files
committed
analyze action: workaround inability to overwrite cache key
refs actions/cache#342 (comment)
1 parent 0948dc7 commit 221d95d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/analyze.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ jobs:
4646
with:
4747
path: data/openskimap
4848
key: openskimap
49+
restore-keys: openskimap-
4950
- name: Download OpenSkiMap
5051
id: download-openskimap
5152
# confusing behavior where inputs.refresh_cache acts like a string not a boolean
5253
# https://stackoverflow.com/questions/76292948/github-action-boolean-input-with-default-value
5354
# https://github.com/actions/runner/issues/1483
5455
# the step if condition stopped working around 2025-01-03, so use bash condition to skip the download if files exist
56+
# NOTE: Do not rely on steps.restore-openskimap.outputs.cache-hit because
57+
# "For a partial key match via restore-keys or a cache miss, it will be set to false" as per
58+
# https://github.com/actions/cache/blob/36f1e144e1c8edb0a652766b484448563d8baf46/restore/README.md#L22
5559
if: steps.inputs.outputs.refresh_cache == 'true' || steps.restore-openskimap.outputs.cache-hit != 'true'
5660
run: |
5761
if [ ! -f "data/openskimap/runs.geojson.xz" ]; then
@@ -64,7 +68,9 @@ jobs:
6468
uses: actions/cache/save@v4
6569
with:
6670
path: data/openskimap
67-
key: openskimap
71+
# overwriting the cache key is not permitted, hence append the run_id on save
72+
# https://github.com/actions/cache/issues/342#issuecomment-673371329
73+
key: openskimap-${{ github.run_id }}
6874
- name: Python Analysis
6975
env:
7076
OPENSKISTATS_SOLAR_SEGMENT_COUNT: ${{ steps.inputs.outputs.solar_segment_count }}

0 commit comments

Comments
 (0)