mirror of
https://github.com/gradle/gradle-build-action
synced 2024-11-23 18:12:15 +00:00
Use 'cache-read-only' for all but default_branch
Cache entries _written_ from jobs run on a non-default branch will be private to other jobs for that branch. When development flow involves working on a feature branch and then merging into 'main', these branch-private cache entries can result in eviction of other (shared) cache entries generated for the default branch. With this change, we make the recommended setup the default, by running with `cache-read-only: true` for any jobs run on a non-default branch. These jobs will be able to read cache entries written from the main branch, but will not write any cache entries. Fixes #143
This commit is contained in:
parent
fe92974cdf
commit
0a36ca9fb8
1 changed files with 5 additions and 3 deletions
|
@ -14,11 +14,13 @@ inputs:
|
|||
default: false
|
||||
|
||||
cache-read-only:
|
||||
description: When 'true', existing entries will be read from the cache but no entries will be written.
|
||||
description: |
|
||||
When 'true', existing entries will be read from the cache but no entries will be written.
|
||||
By default this value is 'false' for workflows on the GitHub default branch and 'true' for workflows on other branches.
|
||||
required: false
|
||||
default: false
|
||||
default: ${{ github.ref_name != github.event.repository.default_branch }}
|
||||
# e.g. Use the following setting to only write cache entries from your 'main' branch
|
||||
# cache-read-only: ${{ github.ref != 'refs/heads/main' }}
|
||||
# cache-read-only: ${{ github.ref_name != 'main' }}
|
||||
|
||||
gradle-home-cache-includes:
|
||||
description: Paths within Gradle User Home to cache.
|
||||
|
|
Loading…
Reference in a new issue