From 20d0f2df6438a4cd5e831474db1692cee38e9450 Mon Sep 17 00:00:00 2001 From: s-weigand Date: Sun, 4 Apr 2021 19:57:39 +0200 Subject: [PATCH] Coverted error message to multiline string literal and used turnarty operator on error message to ensure it isn't undefined. --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 75a9ee6..07825a1 100644 --- a/index.js +++ b/index.js @@ -58,14 +58,14 @@ async function main() { await cache.saveCache(cachePaths, cacheKey); } catch (e) { core.warning( - [ - "There was an error saving the pre-commit environments to cache:\n\n", - `${e.message}\n\n`, - "This only has performance implications and won't change the result of your pre-commit tests.\n", - "If this problem persists on your default branch, you can try to fix it by editing your '.pre-commit-config.yaml'. ", - "I.e. run 'pre-commit autoupdate' or simply add a blank line. ", - "This will result in a different hash value and thus a different cache target.", - ].join("") + `There was an error saving the pre-commit environments to cache: + + ${e.message ? e.message : e} + + This only has performance implications and won't change the result of your pre-commit tests. + If this problem persists on your default branch, you can try to fix it by editing your '.pre-commit-config.yaml'. + I.e. run 'pre-commit autoupdate' or simply add a blank line. + This will result in a different hash value and thus a different cache target.`.replace(/ +/g, '') ); } }