This workflow automatically regenerates the npm lockfile when Dependabot opens or updates a pull request, ensuring dependencies are up to date with the specified Node and npm versions.
47 lines
1.1 KiB
YAML
47 lines
1.1 KiB
YAML
name: Fix Dependabot lockfile
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
regen-lockfile:
|
|
if: github.actor == 'dependabot[bot]'
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.head_ref }}
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.13.0
|
|
cache: npm
|
|
|
|
- name: Pin npm
|
|
run: npm i -g npm@11.8.0
|
|
|
|
- name: Regenerate lockfile with repo toolchain
|
|
run: |
|
|
rm -rf node_modules
|
|
npm install --package-lock-only
|
|
|
|
- name: Commit lockfile if changed
|
|
run: |
|
|
if git diff --quiet -- package-lock.json; then
|
|
echo "No lockfile changes"
|
|
exit 0
|
|
fi
|
|
|
|
git config user.name "dependabot[bot]"
|
|
git config user.email "49699333+dependabot[bot]@users.noreply.github.com"
|
|
git add package-lock.json
|
|
git commit -m "chore(deps): regenerate lockfile with Node 24 / npm 11.8"
|
|
git push
|