mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-11-03 17:18:55 +08:00
Add input to disable dependencies caching altogether
This commit is contained in:
@@ -15,6 +15,8 @@ const DEPENDENCIES_CACHE_RESULT = 'DEPENDENCIES_CACHE_RESULT'
|
||||
export async function restoreCachedDependencies(
|
||||
rootDir: string
|
||||
): Promise<void> {
|
||||
if (isDependenciesCacheDisabled()) return
|
||||
|
||||
const cachePath = path.resolve(os.homedir(), '.gradle/caches/modules-2')
|
||||
core.saveState(DEPENDENCIES_CACHE_PATH, cachePath)
|
||||
|
||||
@@ -52,6 +54,8 @@ export async function restoreCachedDependencies(
|
||||
}
|
||||
|
||||
export async function cacheDependencies(): Promise<void> {
|
||||
if (isDependenciesCacheDisabled()) return
|
||||
|
||||
const cachePath = core.getState(DEPENDENCIES_CACHE_PATH)
|
||||
const cacheKey = core.getState(DEPENDENCIES_CACHE_KEY)
|
||||
const cacheResult = core.getState(DEPENDENCIES_CACHE_RESULT)
|
||||
@@ -107,3 +111,7 @@ function tryDeleteFiles(filePaths: string[]): boolean {
|
||||
}
|
||||
return !failure
|
||||
}
|
||||
|
||||
function isDependenciesCacheDisabled(): boolean {
|
||||
return !github.inputBoolean('dependencies-cache-enabled', true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user