# GitHub

Code repositories: tags, releases, commits, pull requests, files and search

- Category: Apps
- Runs in: the Phloem cloud

Lets Hamming read your repositories — tags, releases, commits, pull requests and files — so it can tie a test result to the code or firmware it ran.

## What Phloem reads
- **Repositories** — the ones the connection can reach
- **Tags, releases and branches** — and what each points at
- **Commits** — full messages, authors, files changed, and the pull requests that merged them
- **Pull requests** — description, state, merge commit, files and commits
- **Files** — a file's text, or a folder's contents, at any branch, tag or commit
- **Code and issue search** — in the connected repositories only

Phloem never writes to GitHub.

## What you need
One of:
- **A GitHub account** to authorize the Phloem GitHub App. You choose its repositories in the App's installation on GitHub. github.com only.
- **An access token** (fine-grained or classic) with read access to code and pull requests. It uses one person's GitHub access. Use this for GitHub Enterprise Server.

## Connect
1. In the console, open **Connectors**, choose **Add connector**, then **GitHub**.
2. Choose **Connect GitHub** and authorize the Phloem GitHub App. Back in the console, you see the repositories it reads.

   Or choose **Use an access token instead** and fill in:
   - **Access token** — `github_pat_…` or `ghp_…`
   - **Repositories** — each as `owner/repository`; required with a token
   - **GitHub Enterprise Server** — the API URL, e.g. `https://github.example.com/api/v3`; empty for github.com
3. Save.

## What Hamming can do
All reads:
- **Repositories** — name, default branch, description, visibility, last push
- **Tags** — all, or those starting with a prefix (e.g. `v2.`)
- **Releases** — newest first, with descriptions
- **Commit** — one commit by sha, branch or tag
- **Commits** — the latest on a branch or path, or all between two refs (e.g. two tags), with files changed
- **Pull requests** and **Pull request**
- **File** — a file or folder at a ref
- **Search documents** — code and issue search
- **Query** — SQL over each repository's tags, releases, branches, pull requests and commits. Run fields can pick a tag, branch, commit or pull request from these tables.

## Notes
- Each call returns at most 1,000 tags, 300 releases, 300 pull requests, 250 commits or 50 search results.
- File text is cut at 200,000 characters, a description at 20,000.
- Search stays inside the connected repositories: `repo:`, `org:` and `user:` qualifiers are refused.
- When GitHub's rate limit runs out, calls fail and say when it resets.

## Connection fields

| Field | Type | Required | Notes |
|---|---|---|---|
| Access token | Secret | No | Uses one person's GitHub access. Read access to code and pull requests is enough. |
| Repositories | Any of | No |  |
| GitHub Enterprise Server | Text | No | Leave empty for github.com. |
