Auto-update dependencies #5
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
| name: Auto-update dependencies | |
| on: | |
| schedule: | |
| # Every day at 02:00 UTC | |
| - cron: "0 2 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-dependencies: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Update dependencies | |
| run: | | |
| npm install -g npm-check-updates | |
| # Update to latest minor+patch (non-breaking) | |
| ncu -u --target minor | |
| # Also apply patch-only updates for packages already at their major | |
| ncu -u --target patch | |
| # Actually upgrade all resolutions in package-lock.json | |
| npm install | |
| # Deduplicate lockfile to remove old vulnerable transitive deps | |
| npm dedupe | |
| - name: Create Pull Request | |
| id: create-pr | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| commit-message: "chore: update dependencies" | |
| title: "chore: update dependencies" | |
| body: | | |
| Automated dependency update. | |
| This PR updates all dependencies in `package.json` and `package-lock.json`. | |
| Please review and merge if all checks pass. | |
| branch: chore/update-dependencies | |
| delete-branch: true | |
| - name: Enable auto-merge | |
| if: steps.create-pr.outputs.pull-request-number | |
| run: | | |
| gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} \ | |
| --auto \ | |
| --squash \ | |
| --delete-branch | |
| env: | |
| GH_TOKEN: ${{ secrets.PAT_TOKEN }} |