Skip to content

Commit

Permalink
Do not save the .m2 cache for pull requests
Browse files Browse the repository at this point in the history
We use the ones coming from the push events.
Related to #43559
  • Loading branch information
gsmet committed Sep 27, 2024
1 parent e2d56c5 commit f4a0501
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ jobs:
- name: Cache Maven Repository
id: cache-maven
uses: actions/cache@v4
# if it's not a pull request, we restore and save the cache
if: github.event_name != 'pull_request'
with:
path: ~/.m2/repository
# A new cache will be stored daily. After that first store of the day, cache save actions will fail because the cache is immutable but it's not a problem.
Expand All @@ -153,6 +155,16 @@ jobs:
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
- name: Restore Maven Repository
uses: actions/cache/restore@v4
# if it a pull request, we restore the cache but we don't save it
if: github.event_name == 'pull_request'
with:
path: ~/.m2/repository
key: ${{ steps.cache-key.outputs.m2-cache-key }}
restore-keys: |
${{ steps.cache-key.outputs.m2-monthly-branch-cache-key }}-
${{ steps.cache-key.outputs.m2-monthly-cache-key }}-
- name: Populate the cache
run: |
./mvnw -T2C $COMMON_MAVEN_ARGS dependency:go-offline
Expand Down

0 comments on commit f4a0501

Please sign in to comment.