From 53e57a851cbaa34d163a676cfb56c113f51c1c54 Mon Sep 17 00:00:00 2001 From: Daz DeBoer Date: Thu, 3 Feb 2022 09:46:37 -0700 Subject: [PATCH] Make Gradle Home detection compatible with MacOS MacOS runners are initialized with a Gradle User Home directory including the `~/.gradle/notifications` directory. This was causing the action to skip restoring the Gradle User Home on MacOS. This fix limits the pre-existing GUH check to the `~/.gradle/caches` directory which isn't pre-initialized in the runner. Fixes #155 --- src/cache-base.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cache-base.ts b/src/cache-base.ts index 81d95ab..4e819c7 100644 --- a/src/cache-base.ts +++ b/src/cache-base.ts @@ -102,12 +102,10 @@ export class GradleStateCache { } cacheOutputExists(): boolean { - const paths = this.getCachePath() - for (const p of paths) { - if (fs.existsSync(p)) { - cacheDebug(`Cache output exists at ${p}`) - return true - } + const cachesDir = path.resolve(this.gradleUserHome, 'caches') + if (fs.existsSync(cachesDir)) { + cacheDebug(`Cache output exists at ${cachesDir}`) + return true } return false }