GitHub Action
A comment on every pull request that changes a dependency, with the lines to check.
Renovate or Dependabot opens a pull request. The Action runs radius on it and posts a comment: the answer for each changed dependency, and the lines to check. On every new push, it updates the same comment. Pull requests that change no dependency get no comment.
Needs dep-radius 0.2.0 or later
The Action is built on --since, which arrives in 0.2.0. The v0 tag always runs a version that
has it.
Set it up with Renovate or Dependabot
Add this file to the repository. It works the same for Renovate and Dependabot.
name: dep-radius
on:
pull_request:
paths:
- "**/package.json"
- "**/package-lock.json"
- "**/pnpm-lock.yaml"
- "**/yarn.lock"
- "**/bun.lock"
permissions:
contents: read
pull-requests: write
jobs:
brief:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: prakticode/dep-radius@v0That's all. No install step: radius reads the lockfile. What each part does:
pull_requestruns it on every pull request, from a bot or a person. Thepathsfilter is optional. It skips pull requests that can't change a dependency. Without it, a pull request that changes no dependency still gets no comment.pull-requests: writelets the job post the comment. Workflows started by Dependabot get a read-only token by default, and this key is how GitHub lets you raise it. Renovate pull requests get the usual token. No secret is needed.actions/checkoutwith its default settings is enough. The Action fetches the one base commit it needs, so there is no need forfetch-depth: 0.@v0follows every 0.x release. See pinning below.
Only on pull requests from the bots
To skip pull requests opened by people, add a condition on the author:
jobs:
brief:
if: >-
github.event.pull_request.user.login == 'renovate[bot]' ||
github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latestThis checks who opened the pull request, not github.actor, which is whoever pushed last. A person
who pushes a fix to a Renovate branch still gets the comment. A self-hosted Renovate uses the login
of its own bot account: use that login instead.
Forks and pull_request_target
Renovate and Dependabot push their branches to your repository, so their pull requests are not forks. A pull request from a fork gets a read-only token that the workflow can't raise. There, the Action shows a warning, doesn't fail, and the result is in the job summary.
Don't switch to pull_request_target to comment on forks. It gives the job a write token. To read
the pull request, the job would have to check out its files, and the Action runs npx inside them.
A .npmrc in those files can point npm at another registry, so the pull request would choose the
code that runs with your token. With pull_request, that risk is gone: a fork only gets a read-only
token, and a branch in your repository was pushed by someone who already has write access.
What you get
- A comment: a table of the changed dependencies and their answers, then a section for each one to check, with files and lines.
- The job summary: the same content, even when commenting isn't allowed.
- A failing check when something your code uses was removed. You can change this with
fail-on. - Outputs you can use in later steps, for example to auto-merge quiet updates.
Inputs
| Input | Default | What |
|---|---|---|
github-token | ${{ github.token }} | Comments on the pull request, and lifts GitHub's limit for release notes |
base | the pull request's base commit | The commit to compare with |
working-directory | . | The folder radius reads, for a project inside a bigger repository |
comment | true | false writes the result to the job summary only |
fail-on | blocked | Fail the step on blocked, on review as well, or never |
version | the one released with the Action | The dep-radius version to run |
args | none | Extra options, like --prod or --no-notes |
Outputs
| Output | What |
|---|---|
verdict | quiet, review, blocked, or none when no direct dependency changed |
exit-code | The radius exit code: 0, 1 or 2 |
json | Path to the result as JSON (the format) |
markdown | Path to the result as Markdown |
Recipes
Be strict: fail on review too
- uses: prakticode/dep-radius@v0
with:
fail-on: reviewAuto-merge quiet updates from Renovate
permissions:
contents: write
pull-requests: write
jobs:
brief:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- id: radius
uses: prakticode/dep-radius@v0
- if: steps.radius.outputs.verdict == 'quiet' && github.event.pull_request.user.login == 'renovate[bot]'
run: gh pr merge --auto --squash "$PR_URL"
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ github.event.pull_request.html_url }}--auto merges only once your required checks pass, and it needs "Allow auto-merge" turned on in
the repository settings.
Keep your tests as a required check
Quiet means nothing your code uses changed, according to the types and the release notes. A change no note mentions is invisible to radius. Auto-merge on quiet and passing tests, never on quiet alone.
A project in a subfolder
- uses: prakticode/dep-radius@v0
with:
working-directory: packages/apiUse the JSON in a later step
- id: radius
uses: prakticode/dep-radius@v0
with:
comment: false
- run: jq '.summary' "${{ steps.radius.outputs.json }}"Good to know
- Dependabot and forks. Dependabot pull requests can be commented on once the job has
pull-requests: write. Pull requests from forks can't, see forks. The result is in the job summary either way. - Pinning.
@v0follows every 0.x release. To pin exactly, use a full tag like@v0.2.0, or setversion. - Node.js. If the runner's Node is older than 22.18, the Action sets up Node 24 for its own steps.
- Every changed version is listed, even ones the pull request title doesn't mention. See does this pull request change more than it says?
- Nothing runs from the pull request. radius reads files. It never installs packages or runs scripts from the branch it analyses.