Repository navigation
Upgrade NPM packages weekly #37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will update packages in package.json using npx, run test scripts (if present) and create a pull request if tests passed. | |
| # Written with help from Gemini, Peter Evans' example and Michael Currin's. | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| name: Upgrade NPM packages weekly | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 0" # Weekly rebuild (Sunday at midnight) | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 | |
| - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: '24.x' | |
| cache: 'npm' | |
| - run: npm ci | |
| - run: npm test --if-present | |
| - run: npm run build --if-present | |
| upgrade-packages: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4.3.1 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: '24.x' | |
| cache: npm | |
| - name: Update dependencies | |
| run: | | |
| npx -p npm-check-updates ncu -u | |
| npm install | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| commit-message: Update dependencies | |
| title: Update dependencies | |
| body: | | |
| - Dependency updates | |
| Auto-generated by [create-pull-request][1] | |
| [1]: https://github.com/peter-evans/create-pull-request | |
| branch: update-dependencies | |
| base: main | |