mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-26 08:42:08 -05:00
Improve messages for cache-disabled scenario
This commit is contained in:
parent
3aa7bfe163
commit
50ca2bca83
1 changed files with 7 additions and 9 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue