Türkçe · English
Turn an unreadable lockfile diff into a summary a reviewer can actually check.
A one-line dependency bump produces three thousand lines of package-lock.json.
Nobody reads it, so nobody notices the transitive package that quietly went from
4.2.1 to 5.0.0 — or the one that appeared out of nowhere.
lockdiff reads the lockfile instead of the diff, and comments what actually changed.
14 changes across 1 file, including major version bumps.
npm · 3 added, 10 updated, 1 removed
Worth a look
react18.3.1 → 19.0.0 — majortar-fs3.0.4 → 2.1.1 — downgrade12 other changes
clsxadded at 2.1.1picocolors1.0.1 → 1.1.1- ...
Major bumps and downgrades sit at the top where they get read. Routine patch bumps go in a collapsed section, so the comment stays short even when the lockfile churns.
There is nothing to install. A GitHub Action lives in your repository as a workflow file, and GitHub runs it for you.
1. In your repository, create the file .github/workflows/dependencies.yml.
You can do this from the GitHub web interface: Add file → Create new file,
then type that path as the filename.
2. Paste this in and commit it:
name: Dependencies
on: pull_request
permissions:
contents: read
pull-requests: write
jobs:
lockdiff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # needed to read the base version of the lockfile
- uses: ato113/lockdiff@v13. Open a pull request that changes a lockfile. Within a minute or so the comment appears on it.
That's the whole setup. The action finds every lockfile the pull request touches, works out what changed, and posts (or updates) one comment.
Two details that matter:
fetch-depth: 0is not optional. Without itactions/checkoutfetches only the latest commit, so there is no earlier lockfile to compare against. The action tells you so rather than silently reporting nothing.pull-requests: writeis what lets the action post the comment. Without it the summary still appears in the Actions run summary, and the step does not fail.
- uses: ato113/lockdiff@v1
with:
fail-on-major: trueThe check then fails when a major bump or a downgrade appears, so it can sit in your required checks.
- uses: ato113/lockdiff@v1
id: lockdiff
with:
comment: false
- if: steps.lockdiff.outputs.breaking == 'true'
run: echo "${{ steps.lockdiff.outputs.summary }}"| Ecosystem | Files |
|---|---|
| npm | package-lock.json, npm-shrinkwrap.json (v1, v2 and v3) |
| Yarn | yarn.lock (classic and Berry) |
| pip | requirements*.txt — exact == pins only |
Loose pip specifiers like django>=4.0 are skipped rather than guessed at:
the file doesn't say which version you'll get, so neither does the summary.
| Input | Default | What it does |
|---|---|---|
github-token |
${{ github.token }} |
Token used to post the comment |
files |
auto | Lockfiles to inspect, one per line. Defaults to every lockfile the PR touches |
base |
the PR base | Ref to compare against |
comment |
true |
Post the summary as a PR comment, updating it on later pushes |
fail-on-major |
false |
Fail the check on a major bump or a downgrade |
| Output | Example |
|---|---|
changed |
14 |
breaking |
true |
summary |
14 dependency changes, including major bumps. |
body |
The full Markdown summary |
fetch-depth: 0is required. The action reads the base version of the lockfile out of git history; a shallow clone doesn't have it. If it's missing, the action says so instead of silently reporting nothing.- A
0.xminor bump counts as major. In practice0.1.0 → 0.2.0breaks things, and a reviewer should see it. - The comment is updated in place on each push, not posted again.
- If the token can't comment, the summary still lands in the Actions run summary and the step doesn't fail.
npm ci
npm test # vitest
npm run typecheck
npm run build # bundles src/ into dist/ with nccdist/ is committed, because that's what GitHub runs. CI fails if it doesn't
match the source, so run npm run build before you commit.
Issues and pull requests welcome. Adding another ecosystem means writing one
parser in src/parsers/ that turns the file into { name, version } pairs —
everything downstream is shared.
AI-assisted contributions are fine as long as you say so in the pull request and can explain what you're submitting.
MIT — see LICENSE.