From c97500dd80e2c0247a2e2dc61e0607a0b319affa Mon Sep 17 00:00:00 2001 From: Pedro Rodrigues Date: Mon, 21 Jun 2021 23:03:58 -0300 Subject: [PATCH] Checking if generated files exist before trying to delete them --- entrypoint.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 526d1ee..6c3f433 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -66,8 +66,17 @@ echo "Files:" prettier $INPUT_PRETTIER_OPTIONS || { PRETTIER_RESULT=$?; echo "Problem running prettier with $INPUT_PRETTIER_OPTIONS"; } # Ignore node modules and other action created files -rm -r node_modules/ || echo "No node_modules/ folder." -git reset --hard package-lock.json || rm package-lock.json || echo "No package-lock.json file." +if [ -d 'node_modules' ]; then + rm -r node_modules/ +else + echo "No node_modules/ folder." +fi + +if [ -f 'package-lock.json' ]; then + git reset --hard package-lock.json || rm package-lock.json +else + echo "No package-lock.json file." +fi # To keep runtime good, just continue if something was changed if _git_changed; then