From cad594695040f83848708b552c74e81445206cee Mon Sep 17 00:00:00 2001
From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com>
Date: Thu, 17 Nov 2022 19:18:01 +0000
Subject: [PATCH] Save cache on failure action update

---
 action.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/action.yml b/action.yml
index 0d1187c..648df27 100644
--- a/action.yml
+++ b/action.yml
@@ -18,6 +18,9 @@ inputs:
     description: 'Fail the workflow if the cache is not found for the given key.'
     required: false
     default: "false"
+  save-on-failure:
+    description: 'Save build cache despite of failure in the job'
+    default: "false"
 outputs:
   cache-hit:
     description: 'A boolean value to indicate an exact match was found for the primary key'
@@ -25,7 +28,7 @@ runs:
   using: 'node16'
   main: 'dist/restore/index.js'
   post: 'dist/save/index.js'
-  post-if: 'success()'
+  post-if: success() || inputs.save-on-failure == "true"
 branding:
   icon: 'archive'
   color: 'gray-dark'