From 9f1ba5cf1ea8706aa00d003823d9c26d9d765bf9 Mon Sep 17 00:00:00 2001 From: Latte Date: Sat, 7 Mar 2026 21:31:48 +0100 Subject: [PATCH] Improve Node.js dependency installation logic in CI workflow --- .gitea/workflows/ci.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 5fb7088..7fdc11b 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -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)