Skip to content

Commit 373be4e

Browse files
author
Aliaksandr Adziareika
committed
Add download-only option
1 parent 4ac6407 commit 373be4e

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/actions/ccache-setup/action.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ inputs:
1818
description: 'Prefix for cache key (e.g., opendaq, test). If not set, no prefix is used.'
1919
required: false
2020
default: ''
21+
download-only:
22+
description: 'If true, only download cache (no auto-save). Use when manually saving cache later with actions/cache/save.'
23+
required: false
24+
default: 'false'
2125

2226
outputs:
2327
cache-hit:
2428
description: 'Whether cache was restored'
25-
value: ${{ steps.cache.outputs.cache-hit }}
29+
value: ${{ steps.cache.outputs.cache-hit || steps.cache-download.outputs.cache-hit }}
2630
cache-key:
2731
description: 'The cache key used'
2832
value: ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-${{ steps.ccache-key.outputs.short-sha }}
@@ -129,7 +133,8 @@ runs:
129133
echo "prefix=" >> "$GITHUB_OUTPUT"
130134
fi
131135
132-
- name: Restore ccache
136+
- name: Restore ccache (with auto-save)
137+
if: inputs.download-only != 'true'
133138
id: cache
134139
uses: actions/cache@v4
135140
with:
@@ -138,6 +143,16 @@ runs:
138143
restore-keys: |
139144
ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-
140145
146+
- name: Restore ccache (download only)
147+
if: inputs.download-only == 'true'
148+
id: cache-download
149+
uses: actions/cache/restore@v4
150+
with:
151+
path: ${{ steps.ccache-key.outputs.dir }}
152+
key: ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-${{ steps.ccache-key.outputs.short-sha }}
153+
restore-keys: |
154+
ccache-${{ steps.ccache-key.outputs.prefix }}${{ steps.ccache-key.outputs.distro }}-${{ steps.ccache-key.outputs.arch }}-${{ steps.ccache-key.outputs.compiler }}-${{ steps.ccache-key.outputs.build-type }}-
155+
141156
- name: Configure ccache
142157
shell: bash
143158
run: |

0 commit comments

Comments
 (0)