Skip to content

Commit

Permalink
ci: Disable cache save for pull requests in GitHub Actions
Browse files Browse the repository at this point in the history
Otherwise, multiple pull requests fill GitHub Actions cache quota
shortly.
  • Loading branch information
hebasto committed Aug 21, 2023
1 parent 723f1c6 commit 241d6ca
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,20 @@ jobs:
- name: Set Ccache directory
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"

- name: Ccache cache
uses: actions/cache@v3
- name: Restore Ccache cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ github.job }}-ccache-cache-${{ github.run_id }}
restore-keys: ${{ github.job }}-ccache-cache
key: ${{ github.job }}-ccache-${{ github.run_id }}
restore-keys: ${{ github.job }}-ccache-

- name: CI script
run: ./ci/test_run_all.sh

- name: Save Ccache cache
uses: actions/cache/save@v3
if: github.event_name != 'pull_request'
with:
path: ${{ env.CCACHE_DIR }}
# https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
key: ${{ github.job }}-ccache-${{ github.run_id }}

0 comments on commit 241d6ca

Please sign in to comment.