mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-06-08 01:06:12 +02:00
Simplify setting caches to disabled or read-only
This commit is contained in:
parent
1c72a31463
commit
3390540145
6 changed files with 24 additions and 39 deletions
|
@ -7,7 +7,7 @@ import * as cache from '@actions/cache'
|
|||
import * as toolCache from '@actions/tool-cache'
|
||||
|
||||
import * as gradlew from './gradlew'
|
||||
import {isCacheReadEnabled, isCacheSaveEnabled} from './cache-utils'
|
||||
import {isCacheDisabled, isCacheReadOnly} from './cache-utils'
|
||||
|
||||
const gradleVersionsBaseUrl = 'https://services.gradle.org/versions'
|
||||
|
||||
|
@ -120,7 +120,7 @@ async function downloadAndCacheGradleDistribution(
|
|||
`gradle-installations/downloads/gradle-${versionInfo.version}-bin.zip`
|
||||
)
|
||||
|
||||
if (!isCacheReadEnabled('distributions')) {
|
||||
if (isCacheDisabled()) {
|
||||
await downloadGradleDistribution(versionInfo, downloadPath)
|
||||
return downloadPath
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ async function downloadAndCacheGradleDistribution(
|
|||
)
|
||||
await downloadGradleDistribution(versionInfo, downloadPath)
|
||||
|
||||
if (isCacheSaveEnabled('distributions')) {
|
||||
if (!isCacheReadOnly()) {
|
||||
try {
|
||||
await cache.saveCache([downloadPath], cacheKey)
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue