Skip to content

Commit 241d6ca

Browse files
committed
ci: Disable cache save for pull requests in GitHub Actions
Otherwise, multiple pull requests fill GitHub Actions cache quota shortly.
1 parent 723f1c6 commit 241d6ca

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,20 @@ jobs:
5151
- name: Set Ccache directory
5252
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
5353

54-
- name: Ccache cache
55-
uses: actions/cache@v3
54+
- name: Restore Ccache cache
55+
uses: actions/cache/restore@v3
5656
with:
5757
path: ${{ env.CCACHE_DIR }}
58-
key: ${{ github.job }}-ccache-cache-${{ github.run_id }}
59-
restore-keys: ${{ github.job }}-ccache-cache
58+
key: ${{ github.job }}-ccache-${{ github.run_id }}
59+
restore-keys: ${{ github.job }}-ccache-
6060

6161
- name: CI script
6262
run: ./ci/test_run_all.sh
63+
64+
- name: Save Ccache cache
65+
uses: actions/cache/save@v3
66+
if: github.event_name != 'pull_request'
67+
with:
68+
path: ${{ env.CCACHE_DIR }}
69+
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
70+
key: ${{ github.job }}-ccache-${{ github.run_id }}

0 commit comments

Comments
 (0)