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
# 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:
description: Paths within Gradle User Home to cache.
required: false
@ -52,10 +59,6 @@ inputs:
# 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`.
# 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:
description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
required: false

View File

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