Unverified Commit 50ca2bca authored by Daz DeBoer's avatar Daz DeBoer
Browse files

Improve messages for cache-disabled scenario

parent 3aa7bfe1
Loading
Loading
Loading
Loading
+7 −9
Changes for src/caches.ts: 7 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
const CACHE_LISTENER = 'CACHE_LISTENER'

export async function restore(gradleUserHome: string): Promise<void> {
    // Only restore cache on first action step in workflow.
    // Bypass restore cache on all but first action step in workflow.
    if (process.env[CACHE_RESTORED_VAR]) {
        core.info('Cache only restored on first action step.')
        return
@@ -17,13 +17,6 @@ export async function restore(gradleUserHome: string): Promise<void> {

    // Initialize the Gradle User Home even when caching is disabled.
    const gradleStateCache = new GradleStateCache(gradleUserHome)
    if (gradleStateCache.cacheOutputExists()) {
        core.info('Gradle User Home already exists: will not restore from cache.')
        // We still add init-scripts for build-scan capture
        gradleStateCache.init()
        return
    }

    gradleStateCache.init()

    if (isCacheDisabled()) {
@@ -31,6 +24,11 @@ export async function restore(gradleUserHome: string): Promise<void> {
        return
    }

    if (gradleStateCache.cacheOutputExists()) {
        core.info('Gradle User Home already exists: will not restore from cache.')
        return
    }

    await core.group('Restore Gradle state from cache', async () => {
        core.saveState(GRADLE_USER_HOME, gradleUserHome)

@@ -72,7 +70,7 @@ function shouldSaveCaches(): boolean {
    }

    if (!core.getState(CACHE_RESTORED_VAR)) {
        core.info('Cache will only be saved in final post-action step.')
        core.info('Cache will not be saved: not restored in main action step.')
        return false
    }