# How do I connect the DecisionPen GitHub connector?

> Canonical: https://decisionpen.com/docs/connect-github

## Summary

The DecisionPen GitHub connector is a DecisionPen-owned GitHub App. An admin installs it on github.com, maps repositories to estate entities, then can **scan repos for architecture discovery** (allowlisted paths → Inbox proposals) and **receive merged-PR implementation evidence** as delivery continues. Nothing joins the Confirmed map until a person accepts it. No edge agent and no Edge API token on this path — auth is the App installation plus webhook signature verification.

## Purpose

Architecture knowledge already lives in repositories (ADRs, manifests, IaC, services). Delivery also lands there when PRs merge. The connector brings both into the Architecture Context Plane so stewards review proposals instead of retyping landscape updates — without making GitHub a requirements system of record or crawling every file/commit.

## What you get

- **Repo → entity mappings** with role *implements* or *documents* (optional monorepo path scope for scans and PR evidence).
- **Architecture discovery scan** — on-demand **Scan architecture** over allowlisted paths (ADRs, architecture docs, README, OpenAPI/compose/Dockerfiles, package/language manifests, Terraform and related IaC, GitHub workflows, etc.). Bounded discovery — not a full-repo crawl / full Enterprise Discovery.
- **Merged-PR evidence** — ongoing implementation signal on mapped entities when PRs merge, but only if architecturally significant (ADR/architecture language in title/body, or allowlisted architecture/tech paths in the diff). Otherwise the delivery returns `ignored_not_architectural` and nothing is indexed.

## Not in v1

- GitHub Enterprise Server
- Writing checks/comments back to GitHub
- Marketplace listing
- GitHub as DecisionPen IdP
- Auto-Confirm of map writes

Permissions: read-only Contents, Pull requests, Metadata.

## Who can set this up

DecisionPen **Administrator**, plus someone who can install GitHub Apps on the target org or account.

## Step 1 — Open GitHub App in Admin

1. Sign in as an **Administrator**.
2. **Admin → Integrations → GitHub App**.
3. If the panel shows disabled / not configured, the environment still needs App credentials and `GITHUB_APP_ENABLED=true` — contact your DecisionPen operator.

## Step 2 — Install the DecisionPen GitHub App

1. Click **Connect GitHub**.
2. Complete the GitHub install (org/account + repo access).
3. GitHub redirects back; DecisionPen binds `installation_id` → your organisation.
4. Confirm an **active** installation appears.

**Already installed but not listed?** Use the panel recovery: paste `installation_id` from the callback URL → **Bind to this org**.

## Step 3 — Load repositories

1. Select the installation if needed.
2. **Repositories → Load from GitHub**.
3. Click a repo or type `owner/name`.

## Step 4 — Map each repo to an entity

1. Confirm repo `owner/name`.
2. Search and pick the **Entity** by name (UUID not required).
3. Optional **Path scope** for monorepos (e.g. `services/billing/**`) — applies to scans and merged-PR evidence.
4. Relation: **Implements** (default) or **Documents**.
5. **Save mapping** (confirmed).

Reject or revoke links later from the existing-links list.

## Step 5 — Scan repos for discovery

1. On a confirmed link, **Scan architecture**.
2. Allowlisted paths are queued (ADRs, architecture docs, key manifests, IaC, workflows, etc.), honouring path scope.
3. Review proposals in **Inbox** — nothing auto-confirms.

Re-run when you want a fresh discovery pass. Re-scans replace the previous scan snapshot for that repo/ref (and path scope) via a stable `remote_id` — they do not stack duplicate index rows. Day-to-day change still arrives from merged PRs.

## Step 6 — Keep the plane current with merges

1. Merge a PR on a mapped repo (respecting path scope).
2. Review Inbox / entity evidence.
3. Accept what should join the Confirmed map.

## Disconnect

1. In DecisionPen: select installation → **Mark removed** (clears binding and links).
2. Uninstall the App in GitHub org settings so webhooks stop.

## FAQ

**Is this the same as DecisionPen MCP?**  
No. MCP uses Edge API tokens for Claude/Cursor. GitHub uses the App install for discovery scans and merged-PR evidence. Many teams use both.

**Do I need an Edge API token for GitHub?**  
No.

**Can I discover architecture from a repo without waiting for a merge?**  
Yes — **Scan architecture** on a confirmed repo↔entity link for a bounded discovery pass.

**Does every commit create evidence?**  
No — ongoing webhook signal is merged pull requests only, filtered by links and path scope. Discovery scans are on-demand and separate.

**Will DecisionPen auto-update the Confirmed map?**  
No. Propose only; humans accept.

**GitHub Enterprise Server?**  
Not in v1 — github.com only.
