Skip to content

Commit d70007a

Browse files
LeonMatthesKDABahayzen-kdab
authored andcommitted
Fix: Only update caches when pushed to main
Otherwise, backports would ruin the caches for all other branches that target `main`.
1 parent ed8552b commit d70007a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/github-cxx-qt-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ jobs:
238238
- name: "Delete previous compiler cache"
239239
# Updating th cache doesn't work from forks
240240
# So update it once it's merged into the repo
241-
if: ${{ steps.compiler-cache-restore.outputs.cache-hit && github.event_name == 'push' }}
241+
if: ${{ steps.compiler-cache-restore.outputs.cache-hit && github.event_name == 'push' && github.ref_name == 'main' }}
242242
continue-on-error: true
243243
run: |
244244
gh extension install actions/gh-actions-cache
@@ -248,7 +248,7 @@ jobs:
248248
- name: "Save Compiler Cache"
249249
# Updating th cache doesn't work from forks
250250
# So update it once it's merged into the repo
251-
if: ${{ github.event_name == 'push' }}
251+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
252252
uses: actions/cache/save@v4
253253
with:
254254
path: /home/runner/.cache/sccache
@@ -546,7 +546,7 @@ jobs:
546546
- name: "Delete previous compiler cache"
547547
# Updating th cache doesn't work from forks
548548
# So update it once it's merged into the repo
549-
if: ${{ steps.compiler-cache-restore.outputs.cache-hit && github.event_name == 'push' }}
549+
if: ${{ steps.compiler-cache-restore.outputs.cache-hit && github.event_name == 'push' && github.ref_name == 'main' }}
550550
continue-on-error: true
551551
run: |
552552
gh extension install actions/gh-actions-cache
@@ -556,7 +556,7 @@ jobs:
556556
- name: "Save Compiler Cache"
557557
# Updating th cache doesn't work from forks
558558
# So update it once it's merged into the repo
559-
if: ${{ github.event_name == 'push' }}
559+
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
560560
uses: actions/cache/save@v4
561561
with:
562562
path: ${{ matrix.compiler_cache_path }}

0 commit comments

Comments
 (0)