From a08a8c0a4b83e4c95a6de05df12c4350531cfeab Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:21:35 +1300 Subject: [PATCH] FIX Ensure nvmdir exists (#42) --- action.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index a526291..df6a81f 100644 --- a/action.yml +++ b/action.yml @@ -205,6 +205,11 @@ runs: fi # Set nvmdir explicitly before installation. Default dir doesn't work for some reason. export NVM_DIR="${HOME}/.nvm" + # Installation fails if install dir is specified but doesn't exist + if ! [[ -d "$NVM_DIR" ]]; then + echo "NVM_DIR '$NVM_DIR' doesn't exist - creating it now" + mkdir $NVM_DIR + fi # Remove any sneaky attempts to put __install-nvm.sh into pull-requests if [[ -f __install-nvm.sh ]]; then rm __install-nvm.sh @@ -218,7 +223,7 @@ runs: exit 1 fi # this loads nvm into the current terminal - [[ -s "$NVM_DIR/nvm.sh" ]] && \. "$NVM_DIR/nvm.sh" + [[ -s "$NVM_DIR/nvm.sh" ]] && \. "$NVM_DIR/nvm.sh" --no-use ADMIN_NPM_VERSION= if [[ -d vendor/silverstripe/admin ]]; then cd vendor/silverstripe/admin