Disable cache-read-only when cache-write-only is set

This commit is contained in:
Daz DeBoer 2022-06-04 11:28:12 -06:00
parent 0a36ca9fb8
commit b02f4f1968
No known key found for this signature in database
GPG key ID: DD6B9F0B06683D5D
2 changed files with 8 additions and 5 deletions

View file

@ -22,6 +22,13 @@ inputs:
# e.g. Use the following setting to only write cache entries from your 'main' branch # e.g. Use the following setting to only write cache entries from your 'main' branch
# cache-read-only: ${{ github.ref_name != 'main' }} # cache-read-only: ${{ github.ref_name != 'main' }}
cache-write-only:
description: |
When 'true', entries will not be restored from the cache but will be saved at the end of the Job.
Setting this to 'true' implies cache-read-only will be 'false'.
required: false
default: false
gradle-home-cache-includes: gradle-home-cache-includes:
description: Paths within Gradle User Home to cache. description: Paths within Gradle User Home to cache.
required: false required: false
@ -52,10 +59,6 @@ inputs:
# The following action properties allow fine-grained tweaking of the action caching behaviour. # The following action properties allow fine-grained tweaking of the action caching behaviour.
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`. # These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
# Use at your own risk! # Use at your own risk!
cache-write-only:
description: When 'true', entries will not be restored from the cache but will be saved at the end of the Job. This allows a 'clean' cache entry to be written.
required: false
default: false
gradle-home-cache-strict-match: gradle-home-cache-strict-match:
description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs. description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
required: false required: false

View file

@ -27,7 +27,7 @@ export function isCacheDisabled(): boolean {
} }
export function isCacheReadOnly(): boolean { export function isCacheReadOnly(): boolean {
return core.getBooleanInput(CACHE_READONLY_PARAMETER) return !isCacheWriteOnly() && core.getBooleanInput(CACHE_READONLY_PARAMETER)
} }
export function isCacheWriteOnly(): boolean { export function isCacheWriteOnly(): boolean {