Skip to content

Commit

Permalink
Short-circuit dependencies and configuration caching if cache dir alr…
Browse files Browse the repository at this point in the history
…eady 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.
  • Loading branch information
eskatos committed Jun 22, 2020
1 parent 7137b09 commit f11e7d6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/main/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/post/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/cache-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
1 change: 1 addition & 0 deletions src/cache-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit f11e7d6

Please sign in to comment.