Skip to content

Commit f2d4e51

Browse files
committed
ci: Avoid saving the same Ccache cache
This occurred when a job was being rerun.
1 parent 14e5de6 commit f2d4e51

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ jobs:
5252
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
5353

5454
- name: Restore Ccache cache
55+
id: ccache-cache
5556
uses: actions/cache/restore@v3
5657
with:
5758
path: ${{ env.CCACHE_DIR }}
@@ -63,7 +64,7 @@ jobs:
6364

6465
- name: Save Ccache cache
6566
uses: actions/cache/save@v3
66-
if: github.event_name != 'pull_request'
67+
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
6768
with:
6869
path: ${{ env.CCACHE_DIR }}
6970
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
@@ -203,6 +204,7 @@ jobs:
203204
Copy-Item -Path "$env:ChocolateyInstall\lib\ccache\tools\ccache-$env:CI_CCACHE_VERSION-windows-x86_64\ccache.exe" -Destination "C:\ccache\cl.exe"
204205
205206
- name: Restore Ccache cache
207+
id: ccache-cache
206208
uses: actions/cache/restore@v3
207209
with:
208210
path: ~/AppData/Local/ccache
@@ -243,7 +245,7 @@ jobs:
243245

244246
- name: Save Ccache cache
245247
uses: actions/cache/save@v3
246-
if: github.event_name != 'pull_request'
248+
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
247249
with:
248250
path: ~/AppData/Local/ccache
249251
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache

0 commit comments

Comments
 (0)