mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 17:12:51 +00:00
Protect wrapper cache restore against tar errors
This commit is contained in:
parent
2dd6cc1801
commit
e3d60b3873
3 changed files with 22 additions and 13 deletions
2
dist/main/index.js
vendored
2
dist/main/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/post/index.js
vendored
2
dist/post/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -26,7 +26,7 @@ export async function restoreCachedWrapperDist(
|
||||||
if (!wrapperSlug) return
|
if (!wrapperSlug) return
|
||||||
|
|
||||||
const wrapperCacheKey = `wrapper-${wrapperSlug}`
|
const wrapperCacheKey = `wrapper-${wrapperSlug}`
|
||||||
const wrapperCachePath = path.join(
|
const wrapperCachePath = path.resolve(
|
||||||
os.homedir(),
|
os.homedir(),
|
||||||
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
|
`.gradle/wrapper/dists/gradle-${wrapperSlug}`
|
||||||
)
|
)
|
||||||
|
@ -35,6 +35,7 @@ export async function restoreCachedWrapperDist(
|
||||||
core.saveState(WRAPPER_CACHE_KEY, wrapperCacheKey)
|
core.saveState(WRAPPER_CACHE_KEY, wrapperCacheKey)
|
||||||
core.saveState(WRAPPER_CACHE_PATH, wrapperCachePath)
|
core.saveState(WRAPPER_CACHE_PATH, wrapperCachePath)
|
||||||
|
|
||||||
|
try {
|
||||||
const restoredKey = await cache.restoreCache(
|
const restoredKey = await cache.restoreCache(
|
||||||
[wrapperCachePath],
|
[wrapperCachePath],
|
||||||
wrapperCacheKey
|
wrapperCacheKey
|
||||||
|
@ -48,8 +49,16 @@ export async function restoreCachedWrapperDist(
|
||||||
}
|
}
|
||||||
|
|
||||||
core.saveState(WRAPPER_CACHE_RESULT, restoredKey)
|
core.saveState(WRAPPER_CACHE_RESULT, restoredKey)
|
||||||
core.info(`Wrapper installation restored from cache key: ${restoredKey}`)
|
core.info(
|
||||||
|
`Wrapper installation restored from cache key: ${restoredKey}`
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
} catch (error) {
|
||||||
|
core.info(
|
||||||
|
`Wrapper installation cache restore failed, expect a Gradle distribution download\n ${error}`
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function cacheWrapperDist(): Promise<void> {
|
export async function cacheWrapperDist(): Promise<void> {
|
||||||
|
|
Loading…
Reference in a new issue