Skip to content

Commit ffad73b

Browse files
Save cache only on pushes to default branch
1 parent d6430d1 commit ffad73b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/reusable-industrial-ci-with-cache.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ jobs:
9696
uses: actions/checkout@v4
9797
with:
9898
ref: ${{ inputs.ref_for_scheduled_build }}
99-
- name: Cache ccache folder
100-
uses: actions/cache@v4
99+
- name: Restore ccache folder
100+
uses: actions/cache/restore@v4
101101
with:
102102
path: ${{ env.CCACHE_DIR }}
103103
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
@@ -128,6 +128,14 @@ jobs:
128128
CXX: ${{ inputs.cxx_compiler }}
129129
CMAKE_ARGS: -DCMAKE_CXX_FLAGS="-isystem /opt/ros/${{ inputs.ros_distro }}/include"
130130
id: ici
131+
- name: Save ccache folder
132+
uses: actions/cache/save@v4
133+
# but only on default branch to save disk space
134+
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
135+
with:
136+
path: ${{ env.CCACHE_DIR }}
137+
key: ccache-${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
138+
131139
- name: Download issue template for target failure # Has to be a local file
132140
if: ${{ always() && steps.ici.outcome == 'failure' && github.event_name == 'schedule' }}
133141
run:

0 commit comments

Comments
 (0)