ruvector/.github/workflows/validate-lockfile.yml
rUv 9108adeeb5 feat: Add automated package-lock.json sync tooling
 New Features:
- sync-lockfile.sh: Auto-sync lock file with package.json changes
- install-hooks.sh: Install git pre-commit hooks
- ci-sync-lockfile.sh: CI/CD auto-fix for lock file issues
- Pre-commit hook: Automatically runs on git commit
- validate-lockfile.yml: GitHub Actions workflow for validation

📚 Documentation:
- CONTRIBUTING.md: Complete contribution guide
- scripts/README.md: Automation scripts documentation

🎯 Benefits:
- Prevents "lock file out of sync" CI/CD failures
- Automatic staging of lock file changes
- Zero manual intervention needed
- Works with any workflow (hooks, manual, CI/CD)

🔧 Usage:
1. Install hooks: ./scripts/install-hooks.sh
2. Add dependencies normally
3. Commit - hook auto-syncs lock file
4. CI validates automatically

Resolves the recurring package-lock.json sync issues.
2025-11-25 21:24:14 +00:00

48 lines
1.1 KiB
YAML

name: Validate Package Lock File
on:
pull_request:
paths:
- 'npm/**/package.json'
- 'npm/package-lock.json'
push:
branches:
- main
- develop
paths:
- 'npm/**/package.json'
- 'npm/package-lock.json'
jobs:
validate-lockfile:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: npm/package-lock.json
- name: Validate lock file is in sync
run: |
cd npm
npm ci --dry-run
- name: Check for lock file changes needed
if: failure()
run: |
echo "❌ package-lock.json is out of sync with package.json"
echo ""
echo "To fix this issue:"
echo " 1. Run: cd npm && npm install"
echo " 2. Commit the updated package-lock.json"
echo " 3. Push to your branch"
echo ""
echo "Or use the automated script:"
echo " ./scripts/sync-lockfile.sh"
exit 1