Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94a9b7a

Browse files
authored
Merge pull request #3155 from github/mbg/node/no-install-in-actions
Don't run `npm install` when in an Actions workflow
2 parents 6592567 + a0ae9ba commit 94a9b7a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/check-node-modules.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/bin/bash
2+
23
set -e
34

5+
# Check if running in GitHub Actions
6+
if [ "$GITHUB_ACTIONS" = "true" ]; then
7+
echo "Running in a GitHub Actions workflow; not running 'npm install'"
8+
exit 0
9+
fi
10+
411
# Check if npm install is likely needed before proceeding
512
if [ ! -d node_modules ] || [ package-lock.json -nt node_modules/.package-lock.json ]; then
13+
echo "Running 'npm install' because 'node_modules/.package-lock.json' appears to be outdated..."
614
npm install
15+
else
16+
echo "Skipping 'npm install' because 'node_modules/.package-lock.json' appears to be up-to-date."
717
fi

0 commit comments

Comments
 (0)