Improve Node.js dependency installation logic in CI workflow
CI / ci (push) Failing after 2m18s
CI / ci (pull_request) Failing after 2m16s
Docker / docker (pull_request) Successful in 28s

This commit is contained in:
2026-03-07 21:31:48 +01:00
parent e91b1a12b8
commit 9f1ba5cf1e
+12 -2
View File
@@ -5,7 +5,7 @@
#
# Detection logic:
# 1. Python: if requirements.txt exists → install deps, lint, test.
# 2. Node/JS: if package.json exists → npm ci, lint, test, build.
# 2. Node/JS: if package.json exists → install deps, lint, test, build.
# 3. Neither detected → print a message and exit 0 (never fail).
#
# Controlled by .ci/config.env:
@@ -198,7 +198,17 @@ jobs:
- name: Install Node dependencies
if: env.HAS_NODE == 'true'
run: npm ci
run: |
# Prefer deterministic install when lockfile is healthy.
# Fallback to npm install if lockfile is out-of-sync.
if [ -f package-lock.json ]; then
if ! npm ci; then
echo "npm ci failed; falling back to npm install"
npm install
fi
else
npm install
fi
# -----------------------------------------------------------------------
# Step 9: Node.js — Lint (only if "lint" script exists in package.json)