mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-06-05 07:46:11 +02:00
Add input to disable dependencies caching altogether
This commit is contained in:
parent
7c8cc1a9ef
commit
3abad5567a
4 changed files with 13 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue