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

# GitHub Code Scanner

> Connect a GitHub repository and PromptGuard finds every unprotected LLM API call in it, then opens a pull request that adds protection.

> [!NOTE]
>
> The GitHub Code Scanner installs as a GitHub App, scans connected repositories for LLM SDK calls that are not routed through PromptGuard, and can open a pull request that fixes them. Scans run when you connect a repository, on pushes to its default branch, and on pull requests.

Detection uses the same AST-based engine as the [CLI](https://docs.promptguard.co/tools/cli.md), it parses the
syntax tree rather than matching text, so a commented-out call or a string that
merely mentions a provider is not reported.

## Install the GitHub App

**1. Install the app**

Go to [github.com/apps/promptguard-security](https://github.com/apps/promptguard-security/installations/new)
and choose the account or organization to install into. You can grant access to
every repository or pick individual ones, PromptGuard only ever sees the
repositories you select.

**2. Connect the installation**

In the dashboard, open [**Connect → Integrations**](https://app.promptguard.co/dashboard/settings/integrations). The GitHub card shows the
installation once GitHub redirects back. Connecting links that installation to
your PromptGuard account.

**3. Connect a repository to a project**

Pick a repository from the available list and choose which PromptGuard
[project](https://docs.promptguard.co/platform/projects.md) it belongs to. Findings and fixes are scoped to
that project.

**A full scan starts as soon as the repository is connected.** You do not need to
trigger the first one.

## What a scan reports

Each scan records how many files it examined, how many LLM calls it found, and
how many of those were unprotected. Progress is reported while it runs, files
discovered, files analyzed, and the current phase, so a large repository shows
movement rather than sitting blank.

Every finding carries:

| Field | Meaning |
| - | - |
| `file_path` · `line_number` | Where the call is |
| `provider` | Which SDK: OpenAI, Anthropic, Google, Cohere, AWS Bedrock |
| `call_type` | The kind of call site that matched |
| `code_snippet` | The source at that location |
| `is_protected` | Whether the call already routes through PromptGuard |
| `fix_available` | Whether this finding can be fixed automatically |
| `severity` | How much the exposure matters |

## Fix pull requests

From a completed scan, open a fix pull request for every unprotected finding, or
select individual findings and fix only those. PromptGuard pushes a branch and
opens the PR against your repository; you review and merge it like any other
change. Nothing is committed to your default branch on your behalf.

> [!WARNING]
>
> **Auto-fix is not wired up yet.** The dashboard shows an auto-fix toggle per
> repository and it saves, but no scan currently opens a pull request on its own,
> every fix PR has to be started from a completed scan as described above. Treat
> the toggle as a stored preference, not as automation, until this note goes away.

## When scans run

| Trigger | Scope |
| - | - |
| Connecting a repository | Full scan |
| **Push** to the repository's default branch | Changed files (added + modified) |
| **Pull request** opened, reopened, or updated | The PR head, plus a GitHub check run on the PR |
| Manual trigger in the dashboard | Full scan, optionally limited to a branch or path |

Push and pull-request scanning follow the repository's **auto-scan** setting.

Two limits worth knowing before you rely on this as a gate:

* **Only pushes to the repository's own default branch are scanned.** Pushes to
  any other branch are ignored. The scan-branch setting below does *not* change
  this, it selects the branch a *full* scan reads from, not which pushes fire
  one.
* **Only one scan runs per repository at a time, and extra events are dropped
  rather than queued.** A manual trigger during a scan returns a clear error, but
  a push or pull-request webhook that arrives while a scan is running is silently
  skipped, no scan record, no check run, no notification. Push three commits in
  quick succession and only the first is scanned. Re-run the scan by hand if you
  need the later commits covered.

## Per-repository settings

| Setting | Effect |
| - | - |
| **Auto-scan** | Scan automatically on push to the default branch, and on pull requests |
| **Auto-fix** | Stored, but not yet acted on, see the note above |
| **Project** | Which PromptGuard project findings belong to |
| **Scan path** | Restrict scanning to a subdirectory, useful in a monorepo |
| **Scan branch** | Which branch a *full* scan reads files from. Defaults to the repository default branch. API-only, there is no dashboard control for it, and it has no effect on which pushes trigger a scan |

## Disconnecting

Disconnecting a repository stops all scanning for it and removes it from the
dashboard. Disconnecting the installation removes every connected repository at
once. To revoke access entirely, uninstall the app from your GitHub account
settings, suspending or uninstalling it in GitHub is reflected in PromptGuard
automatically.

## Scanning without GitHub

The same detection runs locally, with no app install and no repository access:

```bash theme={"system"}
promptguard scan
```

See the [CLI reference](https://docs.promptguard.co/tools/cli.md) for JSON output and CI usage.

## Next steps

> [card] [CLI](https://docs.promptguard.co/tools/cli.md)
>
> Find and route LLM calls from your terminal

> [card] [VS Code extension](https://docs.promptguard.co/tools/vscode.md)
>
> Unprotected LLM calls flagged in your editor

> [card] [Auto-instrumentation](https://docs.promptguard.co/integrations/auto-instrumentation.md)
>
> Which provider calls `init()` patches, and which it does not


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