mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-20 07:08:56 +08:00
Tidy-up caching code
- Extracted common code for Gradle User Home and Project .gradle caches into abstract supertype. - Improve error handling by checking error types
This commit is contained in:
@@ -142,13 +142,14 @@ async function downloadAndCacheGradleDistribution(
|
||||
try {
|
||||
await cache.saveCache([downloadPath], cacheKey)
|
||||
} catch (error) {
|
||||
if (error.name === cache.ValidationError.name) {
|
||||
// Fail on validation errors or non-errors (the latter to keep Typescript happy)
|
||||
if (
|
||||
error instanceof cache.ValidationError ||
|
||||
!(error instanceof Error)
|
||||
) {
|
||||
throw error
|
||||
} else if (error.name === cache.ReserveCacheError.name) {
|
||||
core.info(error.message)
|
||||
} else {
|
||||
core.info(`[warning] ${error.message}`)
|
||||
}
|
||||
core.warning(error.message)
|
||||
}
|
||||
}
|
||||
return downloadPath
|
||||
|
Reference in New Issue
Block a user