fix: fallback to npm install on npm ci failure due to lockfile drift
This commit is contained in:
@@ -88,7 +88,11 @@ jobs:
|
|||||||
rm -f gitleaks.tar.gz
|
rm -f gitleaks.tar.gz
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: |
|
||||||
|
if ! npm ci; then
|
||||||
|
echo "WARNING: npm ci fehlgeschlagen (Lockfile-Drift?). Fallback auf npm install."
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|||||||
@@ -57,7 +57,10 @@ has_tracked_files_under() {
|
|||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
if [ -f "package-lock.json" ]; then
|
if [ -f "package-lock.json" ]; then
|
||||||
echo " Running: npm ci"
|
echo " Running: npm ci"
|
||||||
npm ci
|
if ! npm ci; then
|
||||||
|
echo " WARNING: npm ci fehlgeschlagen (Lockfile ggf. nicht synchron). Fallback auf npm install..."
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo " WARNING: package-lock.json fehlt. Führe npm install aus..."
|
echo " WARNING: package-lock.json fehlt. Führe npm install aus..."
|
||||||
npm install
|
npm install
|
||||||
@@ -92,6 +95,10 @@ install_dependencies_if_needed() {
|
|||||||
echo " package-lock.json unverändert, überspringe npm ci"
|
echo " package-lock.json unverändert, überspringe npm ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f "package-lock.json" ]; then
|
||||||
|
current_lock_hash="$(sha256sum package-lock.json | awk '{print $1}')"
|
||||||
|
fi
|
||||||
|
|
||||||
printf '%s\n' "$current_lock_hash" > "$lock_hash_file"
|
printf '%s\n' "$current_lock_hash" > "$lock_hash_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ has_tracked_files_under() {
|
|||||||
install_dependencies() {
|
install_dependencies() {
|
||||||
if [ -f "package-lock.json" ]; then
|
if [ -f "package-lock.json" ]; then
|
||||||
echo " Running: npm ci"
|
echo " Running: npm ci"
|
||||||
npm ci
|
if ! npm ci; then
|
||||||
|
echo " WARNING: npm ci fehlgeschlagen (Lockfile ggf. nicht synchron). Fallback auf npm install..."
|
||||||
|
npm install
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo " WARNING: package-lock.json fehlt. Führe npm install aus..."
|
echo " WARNING: package-lock.json fehlt. Führe npm install aus..."
|
||||||
npm install
|
npm install
|
||||||
@@ -105,6 +108,10 @@ install_dependencies_if_needed() {
|
|||||||
echo " package-lock.json unverändert, überspringe npm ci"
|
echo " package-lock.json unverändert, überspringe npm ci"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f "package-lock.json" ]; then
|
||||||
|
current_lock_hash="$(sha256sum package-lock.json | awk '{print $1}')"
|
||||||
|
fi
|
||||||
|
|
||||||
printf '%s\n' "$current_lock_hash" > "$lock_hash_file"
|
printf '%s\n' "$current_lock_hash" > "$lock_hash_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user