Unverified Commit 53e57a85 authored by Daz DeBoer's avatar Daz DeBoer
Browse files

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
parent 800e52f3
Loading
Loading
Loading
Loading
+3 −5
Changes for src/cache-base.ts: 3 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -102,13 +102,11 @@ export class GradleStateCache {
    }

    cacheOutputExists(): boolean {
        const paths = this.getCachePath()
        for (const p of paths) {
            if (fs.existsSync(p)) {
                cacheDebug(`Cache output exists at ${p}`)
        const cachesDir = path.resolve(this.gradleUserHome, 'caches')
        if (fs.existsSync(cachesDir)) {
            cacheDebug(`Cache output exists at ${cachesDir}`)
            return true
        }
        }
        return false
    }