# Add Dependency Review to Pull Requests with GitHub Actions

Yes. An agent adds a dependency-review workflow that fails a pull request on a vulnerable or wrongly licensed package, aligned with your existing license policy.

[Run this on Rush](https://cloud.getrush.ai/run/add-dependency-review/github-actions/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent starts by reading what the repository already checks on a pull request, because a dependency review should fill the gap rather than duplicate a job. In a repository like actions/typescript-action there are five workflows under `.github/workflows`: `ci.yml` runs `npm ci`, `npm run format:check`, `npm run lint` and `npm run ci-test` on `pull_request` and `push` to `main`; `check-dist.yml` rebuilds `dist/` with `npm run bundle` and fails on a stale bundle; `linter.yml` runs `super-linter/super-linter/slim@v8`; `codeql-analysis.yml` scans the source; and `licensed.yml` runs `licensee/licensed` against the cached metadata in `.licenses/npm`, but only on `workflow_dispatch`, because its `pull_request` and `push` triggers are commented out. None of them looks at what a pull request adds to `package-lock.json`, so a Dependabot bump that pulls in a package with a published advisory, or a contributor adding a GPL-licensed dependency, passes every check.

It then reads the policy the repository already states so the new check agrees with it. `.licensed.yml` allows `apache-2.0`, `bsd-2-clause`, `bsd-3-clause`, `isc`, `mit`, `cc0-1.0` and `other`, and ignores `@rollup/rollup-linux-x64-gnu`. `.github/dependabot.yml` opens weekly grouped pull requests for `npm` and `github-actions`, which is where most dependency changes will arrive. `package.json` declares one runtime dependency, `@actions/core`, and a longer list of development dependencies for Jest, Rollup, ESLint and Prettier; since `rollup.config.ts` bundles everything into `dist/index.js`, the agent notes that a development dependency never ships to users of the action, which decides the `fail-on-scopes` setting below.

The agent writes one new file, `.github/workflows/dependency-review.yml`, triggered on `pull_request` like the other checks, with `permissions: contents: read` to match `ci.yml`, a checkout step on `actions/checkout@v6` as the other workflows pin it, and `actions/dependency-review-action@v5`. It sets `fail-on-severity: moderate` so the check blocks on moderate, high and critical advisories and lets low ones through with a warning, `fail-on-scopes: runtime` so a vulnerable test runner does not block a release while an advisory in `@actions/core` does, and `allow-licenses` to the same SPDX list `.licensed.yml` allows, minus `other`, which is not an SPDX identifier, so the two license checks cannot disagree. It leaves `comment-summary-in-pr` at its default, `never`, which is why `pull-requests: write` is not needed; a FAQ below covers turning the comment on. The agent does not touch the five existing workflows or the Dependabot configuration.

Before pushing, the agent runs `actionlint` over the new file, using the repository's own `actionlint.yml`, which ignores the `node24` runner-name warning, and runs the super-linter's YAML rules locally so `linter.yml` will not fail on indentation. It pushes the branch and opens the pull request, which is itself a `pull_request` event, so the new workflow runs on its own pull request alongside the existing checks. Because that pull request changes no dependency, the review finds nothing to flag and passes; the agent quotes the job summary in the description and says plainly that the first real test is the next Dependabot pull request, which changes `package-lock.json`.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add a dependency review check to this repository's pull requests. Read every workflow under .github/workflows, .github/dependabot.yml, .licensed.yml and package.json first. Write .github/workflows/dependency-review.yml on pull_request with contents: read permissions and actions/dependency-review-action, failing on moderate or higher severity in runtime scope and allowing only the SPDX licenses the repository's existing license policy allows. Do not change the existing workflows. Validate the file with actionlint, open a pull request, and in its description show the new check's result on the pull request and explain what each setting does.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch that adds exactly one file, `.github/workflows/dependency-review.yml`, around twenty lines long. Nothing under `src/`, `dist/`, `__tests__/` or `.licenses/` changes, so `check-dist.yml` and the CI job pass without rebuilding anything.

The description lists the five existing workflows and what each already covers, then the new workflow's settings with a sentence each: the severity threshold, the runtime-only scope and the reasoning from `rollup.config.ts`, and the license list copied from `.licensed.yml` with `other` dropped and why. It includes the `actionlint` output and the new check's status on the pull request itself. The transcript at `GET /o/{org}/sessions/{id}/messages` holds every file read and every command run.

A reviewer checks three things before merging: that the license list matches the one in `.licensed.yml`, that `fail-on-scopes` matches how the project ships (an action that bundled nothing would want `development` too), and that the repository has the dependency graph enabled under its security settings, which the action needs to diff the two revisions. After merging, the check appears on the next Dependabot pull request, which is where it earns its place.

## Run it on every terminal hand-off

A maintainer who just read an advisory for a transitive package starts this from the terminal with this body and the repository in `resources`, then goes back to what they were doing. The run reads the real workflows and the real license policy, so the new check fits this repository's conventions, pinned action versions included, instead of a copied template.

Send a `request_id`, a UUID, in the body so a retried start returns the run it already began. When the turn ends, `GET /o/{org}/sessions/{id}` names the pull request. The same body sent once per repository you maintain adds the same policy everywhere, each run in its own sandbox with its own pull request, and each reading that repository's own license file.

## Why run it on Rush?

The workflow itself is short; the judgment is in the settings, and getting them wrong is silent. A `fail-on-severity` of `low` blocks Dependabot on advisories nobody will act on, and a license list typed from memory drifts from the one the project already enforces, so the two checks disagree the first time a dual-licensed package arrives. The agent reads the policy the repository already states and derives the settings from it, writing the reason beside each one.

Running it on Rush puts the work in its own sandbox with the repository's Node version from `.node-version`, keeps the `actionlint` output and every file read in the transcript, and ends with the check visible on the pull request that adds it. Several repositories can get the same treatment at once, each from its own license file.

## Frequently asked questions

### Will it change my existing workflows?

No. The agent reads `ci.yml`, `check-dist.yml`, `linter.yml`, `codeql-analysis.yml` and `licensed.yml` to learn the conventions and to avoid duplicating a check, but the pull request adds one new file and edits none of them. Leaving `licensed.yml` on `workflow_dispatch` is a separate decision the description points out.

### Why runtime scope only?

Because of how the action ships. `rollup.config.ts` bundles the source and its runtime dependencies into `dist/index.js`, which is what `uses:` runs; Jest, ESLint and Prettier never reach a user. An advisory in a development dependency is still reported in the job summary, it just does not fail the check. If your project ships development dependencies, say so in the prompt and the agent sets `fail-on-scopes: runtime, development`.

### Can it comment the summary on the pull request?

Yes. Set `comment-summary-in-pr: on-failure` or `always` and add `pull-requests: write` to the workflow's `permissions`. The agent leaves it at `never` by default so the new workflow keeps the same `contents: read` footprint as `ci.yml`; the job summary on the Actions tab has the same information.

### Does the check prove anything on the pull request that adds it?

Only that the workflow is valid and runs: with no change to `package-lock.json`, there is nothing to flag, and the description says so rather than claiming a catch. The first meaningful result comes from the next pull request that changes a dependency, such as the weekly Dependabot group.

### What does the repository need on GitHub's side?

The dependency graph, which the action uses to diff the base and head revisions, and which GitHub enables by default on public repositories. On a private repository, turn it on under the repository's security settings before merging, or the job fails with an API error rather than a review.

## More GitHub Actions jobs

- [Add a Job Summary to a GitHub Action](https://getrush.ai/run/add-job-summary/github-actions/)
- [Add timeout-minutes to Every GitHub Actions Job](https://getrush.ai/run/add-job-timeouts/github-actions/)
- [Set Least-Privilege Permissions on GitHub Actions Workflows](https://getrush.ai/run/add-least-privilege-permissions/github-actions/)

## More jobs like this: Hand off a long task

- [Add Dependency Verification to a Gradle Build](https://getrush.ai/run/add-dependency-verification/gradle/)
- [Add a GitHub Pages Deploy Workflow to an Eleventy Site](https://getrush.ai/run/add-deploy-workflow/eleventy/)
- [Deploy Firebase Functions from GitHub Actions](https://getrush.ai/run/add-deploy-workflow/firebase-functions/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
