Files
itzmineydev/.github/workflows/dependabot-fix.yml
T
Michael 2d7a7c8c57 Add workflow to fix Dependabot lockfile
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.
2026-02-05 08:38:09 +01:00

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