mirror of
https://github.com/github/codeql-action.git
synced 2025-12-21 23:00:14 +08:00
24 lines
775 B
Bash
Executable File
24 lines
775 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
# Check if running in GitHub Actions
|
|
if [ "$GITHUB_ACTIONS" = "true" ]; then
|
|
echo "Running in a GitHub Actions workflow; not running 'npm install'"
|
|
exit 0
|
|
fi
|
|
|
|
# Check if npm install is likely needed before proceeding
|
|
if [ ! -d node_modules ]; then
|
|
echo "Running 'npm install' because 'node_modules' directory is missing."
|
|
npm install
|
|
elif [ package.json -nt package-lock.json ]; then
|
|
echo "Running 'npm install' because 'package-lock.json' appears to be outdated."
|
|
npm install
|
|
elif [ package-lock.json -nt node_modules/.package-lock.json ]; then
|
|
echo "Running 'npm install' because 'node_modules/.package-lock.json' appears to be outdated."
|
|
npm install
|
|
else
|
|
echo "Skipping 'npm install' because everything appears to be up-to-date."
|
|
fi
|