> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reliantlabs.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Run an automated vulnerability scan that files GitHub issues

> Scan your dependencies for known vulnerabilities every night and file a GitHub issue when the scan fails, with a workflow you write that needs no AI model.

By the end of this guide a workflow scans your dependencies every night and files a GitHub issue with the scanner's output when it finds a vulnerability. On later nights it comments on that issue instead of opening another. You write it from a `run` step, `compute` steps and GitHub actions. No step calls an AI model, so it costs no tokens and needs no AI account.

## Before you begin

* The `reliant` CLI, v1.21 or later, signed in ([Sign in and tokens](https://docs.reliantlabs.io/cli/sign-in.md)), with a connected machine that holds the repository ([Run a machine from the terminal](https://docs.reliantlabs.io/cli/run-a-machine.md)). The scan is a command, so this workflow always needs a machine.
* The [GitHub integration](https://docs.reliantlabs.io/integrations/github.md) connected, with the Reliant GitHub App installed on the repository and push access for your own account. Issues are written as `reliant-labs[bot]` by default.
* A scanner on the machine. The default, `reliant forge ci vuln-scan`, runs govulncheck and `npm audit` in a forge project ([Scan dependencies for vulnerabilities](https://docs.reliantlabs.io/guides/forge/scan-dependencies-vulnerabilities.md)). Any command that exits non-zero on findings works.

**1. Write the workflow**

````yaml .reliant/workflows/dependency-sweep.yaml theme={null}
name: dependency-sweep
title: Nightly dependency sweep
description: Scan the project's dependencies for known vulnerabilities every night and file a GitHub issue when the scan fails.

inputs:
  repo:
    type: string
    default: acme/shopfront
    description: The repository to file issues in, as owner/name
  scan_command:
    type: string
    default: reliant forge ci vuln-scan
    description: A command that exits 0 when the dependencies are clean
  title_prefix:
    type: string
    default: "[dependency-sweep]"
    description: Starts every issue title; an open issue with it is updated instead of filing another

triggers:
  - name: nightly
    schedule:
      cron: ["0 3 * * *"]
      timezone: UTC
      overlap: skip
    prompt: Run the nightly dependency sweep.

entry: [scan]

nodes:
  - id: scan
    type: run
    command: "{{ inputs.scan_command }}"
    timeout: 15m

  - id: report
    type: compute
    outputs:
      title: "{{ inputs.title_prefix + ' Vulnerable dependencies found on ' + string(timestamp(now())).substring(0, 10) }}"
      body: |
        `{{ inputs.scan_command }}` exited {{ nodes.scan.exit_code }}.

        ```text
        {{ cel.bind(out, nodes.scan.stdout + nodes.scan.stderr, size(out) > 60000 ? out.substring(size(out) - 60000) : out) }}
        ```

  - id: existing
    type: action
    uses: github/issue.search@1
    with:
      q: "repo:{{ inputs.repo }} is:issue is:open in:title \"{{ inputs.title_prefix }}\""

  - id: open_issue
    type: compute
    outputs:
      number: "{{ nodes.existing.data.items.filter(i, i.title.startsWith(inputs.title_prefix)).map(i, i.number).first().orValue(0) }}"

  - id: file
    type: action
    uses: github/issue.create@1
    with:
      owner: "{{ inputs.repo.split('/')[0] }}"
      repo: "{{ inputs.repo.split('/')[1] }}"
      title: "{{ nodes.report.title }}"
      body: "{{ nodes.report.body }}"
      labels: [security, dependencies]

  - id: comment
    type: action
    uses: github/issue.comment@1
    with:
      owner: "{{ inputs.repo.split('/')[0] }}"
      repo: "{{ inputs.repo.split('/')[1] }}"
      issue_number: "{{ nodes.open_issue.number }}"
      body: |
        Still failing on {{ string(timestamp(now())).substring(0, 10) }}.

        {{ nodes.report.body }}

  - id: clean
    type: save_message
    outcome: success
    args:
      role: assistant
      content: "No vulnerable dependencies: `{{ inputs.scan_command }}` passed."

  - id: filed
    type: save_message
    outcome: success
    args:
      role: assistant
      content: "Vulnerable dependencies reported in {{ inputs.repo }}: {{ has(nodes.file) ? nodes.file.data.html_url : 'issue #' + string(nodes.open_issue.number) }}"

  - id: misconfigured
    type: save_message
    outcome: failure
    args:
      role: assistant
      display_style: warning
      content: "`{{ inputs.scan_command }}` could not run on this machine: {{ nodes.scan.stderr }}"

  - id: failed
    type: save_message
    outcome: failure
    args:
      role: assistant
      display_style: warning
      content: "The scan failed but no issue was filed: {{ has(nodes.file) ? nodes.file.content : (has(nodes.comment) ? nodes.comment.content : nodes.existing.content) }}"

edges:
  - from: scan
    cases:
      - to: clean
        condition: nodes.scan.exit_code == 0
      - to: misconfigured
        condition: nodes.scan.exit_code == 127
    default: report
  - from: report
    default: existing
  - from: existing
    cases:
      - to: failed
        condition: nodes.existing.is_error
    default: open_issue
  - from: open_issue
    cases:
      - to: comment
        condition: nodes.open_issue.number > 0
    default: file
  - from: file
    cases:
      - to: failed
        condition: nodes.file.is_error
    default: filed
  - from: comment
    cases:
      - to: failed
        condition: nodes.comment.is_error
    default: filed

on_failure:
  entry: [note]
  nodes:
    - id: note
      type: save_message
      args:
        role: assistant
        display_style: warning
        content: "dependency-sweep stopped at {{ failure.node_id }}: {{ failure.error }}"
````

The exit code is the verdict: `0` ends at `clean`, `127` (command not found) ends at `misconfigured`, and anything else files. `compute` nodes evaluate [CEL](https://docs.reliantlabs.io/reference/cel-expressions.md) with no model and no shell. `open_issue` re-checks the search hits, because GitHub search matches words, not the exact prefix.

**2. Test both issue paths with scenarios**

Mock the scan and the GitHub calls. This scenario covers a second night with the issue still open:

```yaml .reliant/workflows/dependency-sweep/scenarios/open_issue_gets_a_comment.yaml theme={null}
name: open_issue_gets_a_comment
description: A sweep issue from an earlier night is still open, so tonight's output is added to it

events:
  - node: scan
    output: {exit_code: 1, stderr: "❌ npm audit failed: npm audit found 1 advisory/ies at or above \"high\"\n"}
  - node: existing
    output:
      is_error: false
      data:
        items:
          - {number: 3, title: "Bump lodash to fix [dependency-sweep] findings"}
          - {number: 7, title: "[dependency-sweep] Vulnerable dependencies found on 2026-11-19"}
  - node: comment
    output: {is_error: false, data: {id: 501}}

expect:
  outcome: completed
  completed: [existing, open_issue, comment, filed]
  not_reached: [file]
  node_outputs:
    open_issue: {number: 7}
```

Add scenarios for a clean night, a first finding, a missing scanner and a refused write, then run them:

```bash terminal theme={null}
reliant workflow scenario run
reliant workflow lint
```

```text theme={null}
  ✓ dependency-sweep/clean_night (444ms)
  ✓ dependency-sweep/findings_file_an_issue (7ms)
  ✓ dependency-sweep/issue_refused (5ms)
  ✓ dependency-sweep/open_issue_gets_a_comment (4ms)
  ✓ dependency-sweep/scanner_missing (3ms)
✅ All scenarios passed
1 workflow(s): 0 lint error(s), 0 warning(s)
```

[Test workflows with scenarios](https://docs.reliantlabs.io/guides/workflows/test-workflows-with-scenarios.md) explains the format.

**3. Turn on the schedule**

Commit the workflow, then activate its trigger with your repository:

```bash terminal theme={null}
reliant trigger activate --workflow dependency-sweep --machine build-box \
  --name-prefix guides-sandbox-sweep --param repo=reliant-labs/guides-sandbox \
  --param 'scan_command=reliant forge ci vuln-scan --npm' \
  --param 'title_prefix=[guides-sandbox-sweep]'
```

```text theme={null}
TRIGGER  OUTCOME  ACTIVATION                                                             NOTE
nightly  enabled  guides-sandbox-sweep · nightly (5eafb7d5-3cae-4f23-9719-1faae7f35ab6)  -
```

This test used a sandbox repository and a frontend-only project, hence `--npm`. **Enable** under **Workflows → Library** does the same in the app.

**4. Fire it now and verify the issue**

Don't wait for 3am:

```bash terminal theme={null}
reliant trigger fire "guides-sandbox-sweep · nightly"
reliant trigger events "guides-sandbox-sweep · nightly"
reliant workflow status d558739a-f7a3-5b35-8fbd-a91eb9d6f3a5
```

```text theme={null}
OCCURRED AT           OUTCOME   CHAT                                  DEFINITION
2026-11-20T11:48:31Z  launched  d558739a-f7a3-5b35-8fbd-a91eb9d6f3a5  machine build-box at .reliant/workflows/dependency-sweep.yaml @ main dcf503c, clean ...

  Status:    COMPLETED
  Outcome:   ✓ SUCCESS
    STEP        ACTIVITY          RUNS FAILED  LAST
    scan        ExecuteRunStep       1      1  FAIL
    existing    Action               1         ok
    file        Action               1         ok
    filed       SaveMessage          1         ok
```

`scan` shows `FAIL` because the scanner exited `1`. That's the finding, not a broken run. The issue, opened by `reliant-labs[bot]` with the labels `security` and `dependencies`:

```text theme={null}
[guides-sandbox-sweep] Vulnerable dependencies found on 2026-11-20

`reliant forge ci vuln-scan --npm` exited 1.

Running npm audit in . ...
  ❌ GHSA-35jh-r3h4-6jhm (lodash <4.17.21, high, in web)
      Command Injection in lodash
...
❌ npm audit failed: npm audit found 2 advisory/ies at or above "high"
```

Firing again two minutes later ran `comment` instead of `file`: the issue got a `Still failing on 2026-11-20.` comment and no duplicate was opened.

**5. Clean up**

```bash terminal theme={null}
reliant trigger delete "guides-sandbox-sweep · nightly"
```

Deleting keeps the firing history and the runs. Close the test issue on GitHub.

## What this does not do

* **It does not fix anything.** Upgrading the dependency, or recording an exemption under `ci.vuln_scan.exemptions` in `forge.yaml`, is yours. An agent step could propose the upgrade, but then the run needs an AI account.
* **It does not close the issue.** A clean night ends at `clean` and leaves the issue open. Close it when the fix merges, or add a `github/issue.update@1` step on the clean path.
* **The exit code is the only signal.** A scanner that fails for another reason also files an issue, with the reason in its body.
* **The search can miss a fresh issue.** GitHub indexes new issues with a short delay, so two runs seconds apart could each file one.
* **The machine must be online at 3am.** A suspended [cloud machine](https://docs.reliantlabs.io/machines/cloud.md) is woken. Your own computer must be on, and firings missed for longer than the catch-up window (10 minutes by default) are dropped.

## Troubleshooting

> [accordion] govulncheck is not on PATH, so the Go vulnerability gate cannot run
>
> The gate refuses to pass a scan it could not run. Install govulncheck on the machine (`go install golang.org/x/vuln/cmd/govulncheck@latest`), or put `--npm` in `scan_command`. In forge v1.6.1 a site project with no Go module asks for it too.

> [accordion] The scan failed but no issue was filed: not found
>
> GitHub answers "not found" when the Reliant GitHub App is not installed on the repository. Install it, or check the `repo` input. A bot write also fails if your own account cannot push to the repository.

## Next steps

> [card] [Scan dependencies for vulnerabilities](https://docs.reliantlabs.io/guides/forge/scan-dependencies-vulnerabilities.md)
>
> What `reliant forge ci vuln-scan` gates on, and how to record an exemption.

> [card] [Agent on a schedule](https://docs.reliantlabs.io/guides/workflows/run-an-agent-on-a-schedule.md)
>
> Schedule triggers, overlap and the catch-up window.

> [card] [Post a daily digest to Slack](https://docs.reliantlabs.io/guides/workflows/daily-slack-digest.md)
>
> Report to a channel instead of an issue.

> [card] [How automations fire](https://docs.reliantlabs.io/deep-dives/how-automations-fire.md)
>
> What happens between the 3am slot and the run's first step.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.