Skip to content

πŸš€ Dependency Update and Vulnerability Scan #1

πŸš€ Dependency Update and Vulnerability Scan

πŸš€ Dependency Update and Vulnerability Scan #1

name: πŸš€ Dependency Update and Vulnerability Scan
on:
schedule:
- cron: '0 2 * * 0' # Runs weekly on Sunday at 2 a.m. UTC
workflow_dispatch: # Allows manual triggering
jobs:
update-and-scan:
runs-on: ubuntu-latest
steps:
- name: πŸ› οΈ Checkout code
uses: actions/checkout@v4
- name: πŸ”§ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: πŸ—‘οΈ Remove package-lock.json
run: rm -f package-lock.json
- name: πŸ“¦ Install npm-check-updates
run: npm install -g npm-check-updates
- name: ⬆️ Update all npm packages
run: |
ncu -u
npm install
- name: πŸ“¦ Update dependencies with legacy peer deps
run: npm update --legacy-peer-deps
- name: πŸ”¨ Build
run: npm run build
- name: πŸ§ͺ Test with coverage
run: npm run test
- name: πŸ“ Commit changes
if: success()
run: |
git config --local user.name "Debugging Duck πŸ¦†"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add .
git diff-index --quiet HEAD || git commit -m "⬆️ update all npm dependencies ⬆️"
- name: πŸš€ Push changes
if: success()
run: git push
- name: 🚨 Notify failure
if: failure()
run: echo "Build or tests failed. Please investigate."