Unverified Commit 8ab7c9d8 authored by Daz DeBoer's avatar Daz DeBoer
Browse files

Do not fail action on cache errors

Ensure that we catch and log errors in `beforeSave` and `afterRestore`,
and do not fail the entire workflow in these cases.
parent 0cf00ed7
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+13
Changes for src/cache-utils.ts: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -141,7 +141,13 @@ export abstract class AbstractCache {
            `Restored ${this.cacheDescription} from cache key: ${cacheResult}`
        )

        try {
            await this.afterRestore()
        } catch (error) {
            core.warning(
                `Restore ${this.cacheDescription} failed in 'afterRestore': ${error}`
            )
        }

        return
    }
@@ -193,7 +199,14 @@ export abstract class AbstractCache {
            return
        }

        try {
            await this.beforeSave()
        } catch (error) {
            core.warning(
                `Save ${this.cacheDescription} failed in 'beforeSave': ${error}`
            )
            return
        }

        core.info(
            `Caching ${this.cacheDescription} with cache key: ${cacheKey}`