Short-circuit dependencies and configuration caching if cache dir already exists

This is relevant if you run this action several times in a single job.
This prevent doing unnecessary work starting with the second job using the action.
This prevent droping dependencies downloaded by the first job using the action.
This prevent Windows agents to fail unlinking already existing files.
This commit is contained in:
Paul Merlin 2020-06-22 16:40:58 +02:00
parent 7137b09ae2
commit f11e7d60d7
4 changed files with 4 additions and 2 deletions

2
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/post/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -19,6 +19,7 @@ export async function restoreCachedConfiguration(
if (isConfigurationCacheDisabled()) return
const cachePath = path.resolve(rootDir, '.gradle/configuration-cache')
if (fs.existsSync(cachePath)) return
core.saveState(CONFIGURATION_CACHE_PATH, cachePath)
const inputCacheExact = github.inputBoolean('configuration-cache-exact')

View file

@ -18,6 +18,7 @@ export async function restoreCachedDependencies(
if (isDependenciesCacheDisabled()) return
const cachePath = path.resolve(os.homedir(), '.gradle/caches/modules-2')
if (fs.existsSync(cachePath)) return
core.saveState(DEPENDENCIES_CACHE_PATH, cachePath)
const inputCacheExact = github.inputBoolean('dependencies-cache-exact')