Skip to content

Commit 32368cd

Browse files
committed
Merge bitcoin/bitcoin#33905: ci: Consistenly only cache on the default branch
fa411f9 ci: Consistenly only cache on the default branch (MarcoFalke) Pull request description: Fixes bitcoin/bitcoin#33685 The general idea for caches is to only save them on pushes to the default branch, because the cache is limited in size and time that the only benefit of the cache can be to speed up pull requests against the default branch. Backport pull requests to older branches don't benefit from caches, because usually they will be running into a cache miss anyway. Also, they would cause the cache size to overflow and lead to cache misses down the line. So fix it by consistently applying cache saves only on the default branch. For reference, the same is already done for the composite action in this repo: https://github.com/bitcoin/bitcoin/blob/2444488f6ad32dcbbed51a73cd4f59ff3a239e32/.github/actions/save-caches/action.yml#L15 ACKs for top commit: hebasto: ACK fa411f9. willcl-ark: ACK fa411f9 Tree-SHA512: 59d3de4201b596e5f7eb1915c4bd5ded80bcd4df217f8f5d62d92fa8977a77e2c4c8602b17755b33ff0dfa87f2896e7c1c8f4da8e6a77c111f2a42ec9cf78ffd
2 parents e55c49f + fa411f9 commit 32368cd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196

197197
- name: Save Ccache cache
198198
uses: actions/cache/save@v4
199-
if: github.event_name != 'pull_request' && steps.ccache-cache.outputs.cache-hit != 'true'
199+
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.ccache-cache.outputs.cache-hit != 'true'
200200
with:
201201
path: ${{ env.CCACHE_DIR }}
202202
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
@@ -276,7 +276,7 @@ jobs:
276276
277277
- name: Save vcpkg binary cache
278278
uses: actions/cache/save@v4
279-
if: github.event_name != 'pull_request' && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
279+
if: github.event_name != 'pull_request' && github.ref_name == github.event.repository.default_branch && steps.vcpkg-binary-cache.outputs.cache-hit != 'true' && matrix.job-type == 'standard'
280280
with:
281281
path: ~/AppData/Local/vcpkg/archives
282282
key: ${{ github.job }}-vcpkg-binary-${{ hashFiles('cmake_version', 'msbuild_version', 'toolset_version', 'vcpkg.json') }}

0 commit comments

Comments
 (0)