> For the complete documentation index, see [llms.txt](https://herd-security.gitbook.io/herd-security-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/github-integration.md). Agents can also search and read this documentation through its [MCP server](https://herd-security.gitbook.io/herd-security-docs/~gitbook/mcp).

# GitHub Integration

Connect the Herd GitHub App to pull engineering signals from the repositories you choose, see how much of each pull request was written by AI, turn committed secrets and force-pushes into human-risk e

## Overview

The **GitHub Integration** connects Herd to your GitHub organization through the **Herd Sec** GitHub App. Herd reads from your repositories and never changes anything in them. The only thing it writes is two informational check runs on pull requests (see [Herd checks on your GitHub pull requests](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/github-integration/github-pull-request-checks.md)), and those are off until an organization owner grants the permission.

Once connected, it provides five things:

* **Repository signals:** scans the repositories you select for engineering-health and AI-enablement signals (Claude Code review adoption, GitHub Actions hygiene, automation usage, lead time) and feeds them into your [Organizational Context](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/general-and-approvals.md#your-organizational-context), so the content HerdAI writes reflects how your team actually works.
* **PR transparency:** classifies every pull request in a selected repository as **Human**, **AI-assisted**, **AI-authored** or **Agent**, from the evidence GitHub exposes (co-author trailers, commit author names and emails, generation markers, bot accounts).
* **Code-security risk signals:** turns secret-scanning alerts, push-protection bypasses and force-pushes to the default branch into events on the responsible person's human risk score, which can trigger corrective training.
* **Developer training from your code:** ask HerdAI for a secure-coding training grounded in a repository, or generate one from a single pull request's diff.
* **Informational pull-request checks:** posts **Herd / AI authorship** and **Herd / Secret remediation** check runs so developers see what Herd found without leaving GitHub. Both always finish as neutral and never block a merge. See [Herd checks on your GitHub pull requests](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/github-integration/github-pull-request-checks.md).

To set it up, open the **GitHub** card under **Settings → Integrations** (in the **Dev & Compliance** section) and click **Open GitHub setup**.

{% hint style="info" %}
Depending on your plan, the GitHub setup opens with its controls greyed out under a **GitHub integration isn't on your plan yet** banner; choose **I'm interested** or contact your Herd representative.
{% endhint %}

***

## Connecting

1. On the GitHub setup page, click **Connect GitHub** and complete the installation on GitHub, choosing which repositories the Herd App may see. A GitHub organization owner has to approve the installation.
2. Back in Herd, the page shows **Connected to** your account. If your organization has Agent oversight, Herd starts looking for AI agents in every repository you granted the App, with nothing to pick. To narrow it, change the App's repository access in GitHub (organization settings, GitHub Apps, Herd Sec).
3. Under **Repositories to scan**, pick the repos you want included in everything else (signals, pull-request analysis and risk sensitivity use only selected repos) and click **Save selection**.
4. Click **Run scan** to populate signals immediately; scans also run on a schedule from then on.

An older connection that Herd was already reading looks for agents only in its selected repositories until an admin with the integration permission clicks **Scan all granted repositories for agents** on the **Connected to** card (shown when your organization has Agent oversight) and confirms. Herd reads at most 50 repositories per pass, recently changed ones first, and the card says when some are left for a later pass. Once Herd has been through every repository it rests for a week before going through them again, except for repositories that changed in the meantime, which it reads first.

***

## What Herd can see

Every permission below is read-only except **Checks**, which exists solely so Herd can post its two informational pull-request checks. Herd never stores the value of a secret, only that an alert fired.

| Permission                         | What Herd uses it for                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Metadata** (repository)          | Required by every GitHub App; also the language breakdown used to ground developer trainings.                                                                                                                                                                                                                                                                                                                                                                    |
| **Contents** (repository)          | The top-level layout, README and dependency manifests of selected repos, commit authors, and the push events behind the force-push signal. Agent discovery also reads agent configuration files, workflow files and MCP config files in every repository the App was granted for a new connection or an older one an admin has switched on; automatic scans and analyses stay on selected repositories.                                                          |
| **Pull requests** (repository)     | Pull requests, their commits, reviews and changed files, for PR transparency and training generation from a PR.                                                                                                                                                                                                                                                                                                                                                  |
| **Issues** (repository)            | Pull-request conversation comments (GitHub serves these through the issues endpoint), for the review-adoption signal.                                                                                                                                                                                                                                                                                                                                            |
| **Actions** (repository)           | Workflow runs: the workflow name, outcome, branch, who started it and when, for the Actions hygiene signals and, for a workflow where Herd found an AI agent, that agent's activity record. Run logs, jobs and steps are not read. Workflow files are read by agent discovery, through Contents.                                                                                                                                                                 |
| **Secret scanning alerts** (repo)  | Secret-scanning alerts and push-protection bypasses, so each can be attributed to a person as a risk event.                                                                                                                                                                                                                                                                                                                                                      |
| **Members** (organization)         | SAML identities and verified-domain email addresses (GitHub Enterprise Cloud), used to match GitHub accounts to Herd users automatically.                                                                                                                                                                                                                                                                                                                        |
| **Email addresses** (account)      | Only when a member links their own GitHub account: their verified email addresses, to confirm the account belongs to them.                                                                                                                                                                                                                                                                                                                                       |
| **Checks: Read and write** (repo)  | The only write permission. Posts the two informational [pull-request checks](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/github-integration/github-pull-request-checks.md); requires an organization owner's approval.                                                                                                                                                                                                   |
| **Copilot metrics** (organization) | Optional, for Agent oversight. Once a night Herd reads GitHub's Copilot usage report for your organization: how many people used Copilot CLI, the Copilot cloud agent, and agent mode. The report names nobody, and Herd stores no GitHub login from it. Requires an organization owner's approval and the **Copilot usage metrics** policy turned on in your GitHub organization. Without it, Herd shows no Copilot counts and everything else works as before. |

The same list, with every other integration's permissions, is on the integration-permissions page HerdAI can answer from. Use it as the reference for a security or vendor-risk review.

***

## Repository signals

The **Recent signals** table on the GitHub setup page lists each finding with its repo, signal, severity, summary, and when it was observed. The **Recent signals** heading and **All DevSec signal in Intelligence →** open [Intelligence › DevSec signal](https://herd-security.gitbook.io/herd-security-docs/reporting/intelligence.md#github-findings), which lists every signal and every per-person GitHub event that feeds a risk score, each with guidance on how to fix it. Signals include:

* **Claude Code review adoption:** how consistently AI code review is used on pull requests.
* **Actions present / Actions hygiene / Actions cancelled rate:** CI health.
* **Automation usage** and **Lead time (hours)**.

These signals are organization-level. They shape the [Organizational Context](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/general-and-approvals.md#your-organizational-context) that HerdAI writes from, and they show on Intelligence, under **Context signals** on the Human Risk Score page and on **DevSec signal**. They don't appear in [AI Insights → Findings](https://herd-security.gitbook.io/herd-security-docs/ai/ai-coach/findings.md) and never change anyone's AI Insights score.

***

## PR transparency

Click **PR transparency** on the GitHub setup page to open the pull-request view. Every pull request in a selected repository is classified from the evidence GitHub exposes:

| Class           | Meaning                                                                                     |
| --------------- | ------------------------------------------------------------------------------------------- |
| **Human**       | No AI markers on any commit.                                                                |
| **AI-assisted** | Some commits carry AI co-author trailers or generation markers; a human is the main author. |
| **AI-authored** | Most commits are AI-attributed.                                                             |
| **Agent**       | The PR was opened by, or its commits were authored by, a known autonomous-agent account.    |

Merge commits and commits by non-AI bot accounts (such as Dependabot or GitHub Actions) count as **automated** and are left out of the AI-versus-human ratio; the table shows them alongside the ratio, for example *89% (8/9 · 2 automated)*. A pull request with only automated commits isn't classified. Pull requests analyzed before this was introduced show 0 automated until they're analyzed again.

Summary cards show the breakdown and your organization's overall AI-authorship ratio; the table can be filtered by repository and class, and each row links to the pull request on GitHub. Where a Claude Code session produced the pull request (matched by commit SHA), the row also shows the scored conversations behind it.

{% hint style="info" %}
Classification uses only what GitHub records: co-author trailers, commit author names and emails, commit and PR text, and bot accounts. Herd does not see prompts, does not attribute individual lines, and does not score code quality.
{% endhint %}

### Generate a training from a pull request

On a pull request's row, click **Generate training** to have HerdAI build a secure-coding training grounded in that PR's diff. It goes through the usual training review and approval flow; once it is live, it is assigned to the PR's author automatically when their GitHub account is linked to a Herd user.

For a training based on a whole repository, ask HerdAI directly, for example *"make a training for our developers based on our main repo."* HerdAI reads the repository's languages, top-level layout, README, dependency manifests and workflow names, and produces a draft for you to preview and approve.

***

## Code-security risk signals

Three events from GitHub feed the human risk score shown under **Intelligence**:

* **A secret was committed:** GitHub's secret scanning raised an alert on a commit.
* **Push protection was bypassed:** push protection blocked a secret and the author overrode it.
* **Force-push to the default branch:** a force-push to the repository's default branch. Force-pushes to feature branches are ignored.

Depending on your plan, **review hygiene** on merged pull requests feeds it too: a merge with no review, a self-approved merge, and a rubber-stamped approval raise the person's risk, and a substantive review lowers it. Review history starts when this is turned on for your organization, and rubber-stamped approvals are only flagged once at least 20 reviews have been recorded.

Each event is attributed to the person responsible, in the same **alerts** category as SIEM and email-provider alerts, and can trigger a corrective training the same way. An alert that GitHub later resolves as a false positive or a test value cancels its event.

{% hint style="warning" %}
An event is only attributed when the GitHub account resolves to a Herd user. Until a developer's account is linked (see below), their events are recorded against nobody and their score is unaffected. Link accounts before relying on these signals.
{% endhint %}

### Weighting findings by repository sensitivity

Not every repository carries the same risk. In the repository list on the GitHub setup page, each saved repository has a sensitivity dropdown (**High (1.5×)**, **Normal (1×)**, **Low (0.5×)**) that sets how much that repository's code-change findings count toward people's risk scores:

| Sensitivity | Weight |
| ----------- | ------ |
| **High**    | 1.5×   |
| **Normal**  | 1×     |
| **Low**     | 0.5×   |

* **What's weighted:** code-change findings, meaning unreviewed merges, self-approved merges, rubber-stamped approvals, and force-pushes to the default branch.
* **What's never weighted:** committed secrets, push-protection bypasses, and good (substantive) reviews always count in full.
* Every repository starts as **Normal**, so nothing changes until you mark one. **Low** halves a finding's weight but never removes it.
* The change saves as soon as you pick a value and applies from the next risk-score recompute, including to findings already on record.
* Deselecting a repository clears its mark, as does removing it from the Herd app's access in GitHub.

Changing sensitivity needs the risk-scoring configuration permission and a plan that includes risk scoring, because it changes how risk scores are computed. Without both you see the dropdowns read-only, with a note explaining why.

Each weighted finding on a person's risk page, and in the Intelligence scoring-impact table, carries a note such as *weighted ×0.5 (low-sensitivity repo: website)*.

***

## Linking GitHub accounts to people

Click **GitHub identities** on the GitHub setup page to see who is linked, which GitHub accounts have not resolved to anyone, and where each link came from. Herd links accounts from several sources, strongest first:

1. **Admin:** set on the user's record.
2. **SAML:** the identity your IdP asserts (GitHub Enterprise Cloud with SAML).
3. **Verified-domain email:** a GitHub account whose verified email is on your organization's verified domain (GitHub Enterprise Cloud).
4. **Self-serve link:** the member authorizes the Herd App from their own GitHub account and Herd confirms a verified email matches their Herd user.
5. **Commit email:** a commit author email that matches a Herd user's work email.

Automatic sources are swept daily. For everyone else, use the **Audience** picker on the GitHub identities page to choose who should be asked, then confirm **Send the GitHub link prompt?** Herd sends the prompt over Slack or Teams, with a link to the **Connect GitHub** page in Herd. Each person receives at most two messages (one ask and one reminder), and a dismissal is permanent. Members can unlink from that page with **Unlink GitHub account**; an admin can unlink from the user's record.

***

## What the integration does not do

* It does not comment on pull requests, review them, open issues, apply labels or change any code. The only thing it writes is the two informational [check runs](https://herd-security.gitbook.io/herd-security-docs/setup-and-integrations/settings/github-integration/github-pull-request-checks.md), and those never block a merge.
* It does not scan code for vulnerabilities or ingest Code Scanning or SAST results.
* It does not score code quality or review quality.
* It does not read workflow files, only their names and run outcomes.

***

## Disconnecting

Click **Disconnect** (you'll be asked to type the account name to confirm). This uninstalls the Herd App from GitHub and removes Herd's access; snapshots, signals and pull-request analyses already collected are retained.
