Dependabot
GitHub’s dependency graph powers Dependabot alerts, but it only understands the
lockfile formats GitHub supports. For anything else — such as pnpm 12 lockfiles,
which contain multiple YAML documents — GitHub falls back to the version ranges
in package.json, or misses dependencies entirely. That means missing or
inaccurate alerts, especially for transitive dependencies.
denvig already parses these lockfiles, so it can generate the resolved graph for
you. denvig deps list --format dependabot outputs a GitHub
dependency snapshot
that CI can submit to the dependency submission API. Dependabot then alerts
against the exact versions you have installed, including transitive ones.
How it works
Section titled “How it works”denvig deps list --format dependabot --ecosystem npm- The commit SHA and ref are read from the GitHub Actions or CircleCI environment, falling back to the local git checkout. On pull requests the PR head commit is used.
- Each project directory and
--ecosystemfilter gets its own snapshot correlator, so separate submissions don’t replace each other. - Each submission replaces the previous one with the same correlator for the
same ref, so submitting on every push to
mainkeeps the graph current.
Submitting the snapshot needs a token with write access to repository contents.
Disable GitHub’s automatic detection
Section titled “Disable GitHub’s automatic detection”When denvig submits your dependency graph, we recommend turning off GitHub’s own automatic dependency submission for the repository. Otherwise GitHub’s detected graph sits alongside denvig’s, and Dependabot can raise duplicate alerts or keep alerting on the inaccurate ranges you’re trying to replace.
-
Open your repository on GitHub and go to Settings.
-
Under Security, open Advanced Security (called Code security on some plans).
-
In the Dependency graph section, set Automatic dependency submission to Disabled.
Keep the dependency graph itself and Dependabot alerts enabled — they’re what consume the snapshots denvig submits.
GitHub Actions
Section titled “GitHub Actions”Add a workflow that submits the snapshot on every push to main. The built-in
github.token can submit snapshots as long as the job has contents: write, and
the gh CLI is preinstalled on GitHub-hosted runners.
name: dependencies
on: push: branches: [main]
jobs: # GitHub's dependency graph only sees package.json ranges for pnpm lockfiles, # so submit the resolved graph ourselves for accurate Dependabot alerts. # Each submission replaces the previous one for the same ref. dependencies: runs-on: ubuntu-latest
permissions: contents: write
steps: - uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7 with: node-version: 24 cache: pnpm
- run: pnpm install --frozen-lockfile
- env: GH_TOKEN: ${{ github.token }} run: | pnpm exec denvig deps list --format dependabot --ecosystem npm \ | gh api "repos/$GITHUB_REPOSITORY/dependency-graph/snapshots" --method POST --input -This assumes denvig is a dev dependency of the project. If it isn’t, install
it in an earlier step (see installation) and call
denvig directly instead of pnpm exec denvig.
Pull requests
Section titled “Pull requests”Submitting on pull requests lets GitHub’s dependency review show changes against
the resolved graph. Add a pull_request trigger, and skip the job for pull
requests from forks, which only get a read-only token:
on: push: branches: [main] pull_request: branches: [main]
jobs: dependencies: runs-on: ubuntu-latest
# Fork PRs get a read-only token, so they can't submit if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
# ...same permissions and steps as aboveCircleCI
Section titled “CircleCI”CircleCI has no built-in GitHub token, so create one and store it in the project:
-
Create a fine-grained personal access token (or GitHub App token) with access to the repository and the Contents: Read and write permission.
-
In CircleCI, add it to your project (or a context) as an environment variable named
GITHUB_TOKEN.
Then add a job that submits the snapshot with curl. denvig reads the commit and
branch from CircleCI’s CIRCLE_SHA1 and CIRCLE_BRANCH variables:
version: 2.1
jobs: dependencies: docker: - image: cimg/node:lts steps: - checkout - run: corepack enable - run: pnpm install --frozen-lockfile - run: name: Submit dependency snapshot command: | pnpm exec denvig deps list --format dependabot --ecosystem npm \ | curl --fail-with-body -sS -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ -H "X-GitHub-Api-Version: 2022-11-28" \ --data-binary @- \ "https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/dependency-graph/snapshots"
workflows: dependencies: jobs: - dependencies: filters: branches: only: mainVerifying submissions
Section titled “Verifying submissions”After the job runs, open Insights → Dependency graph in your repository. The
pnpm-lock.yaml manifest should list resolved versions and transitive
dependencies. You can also check the submitted graph from the command line by
exporting the repository’s SBOM:
gh api "repos/OWNER/REPO/dependency-graph/sbom" --jq '.sbom.packages | length'