From af04ca59e9f24892f2e0cf1a783feedd9e88ad06 Mon Sep 17 00:00:00 2001 From: Bruno Barbieri Date: Fri, 6 Jul 2018 15:26:06 -0400 Subject: Run npm install only when needed --- .circleci/config.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 63f6a64b1..e41b919fa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -108,7 +108,10 @@ jobs: - run: name: Install deps via npm command: | - sudo npm install -g npm@6 + # Only run npm install if the package-lock.json or package.json was changed + CHANGED_FILES="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" + echo "$CHANGED_FILES" | grep --quiet "package.*json" && + sudo npm install -g npm@6 && npm install - save_cache: key: dependency-cache-{{ checksum "package-lock.json" }} -- cgit v1.2.3