GitHub
Use GitHub as the forge and GitHub Issues as the tracker, through the GitHub CLI, for the hand-off checks and harness-kit tracker.
You'll: let Policies ask GitHub about pull requests and issues, and let the agent (and you) use harness-kit tracker on GitHub Issues. harness-kit asks through two adapters: a forge (pull requests) and a tracker (issues). The GitHub adapters answer both through the GitHub CLI, gh.
Before you start
ghis installed on the machine that runs the session.- You have run
gh auth login, orGH_TOKENis set in the environment Claude Code starts with. The adapters act as that account, so it needs access to the repository's pull requests and issues. - GitHub Issues has no board: ranking, sprints and custom fields are not supported, and the checks that need them say so. For those, use Jira.
Connect GitHub as forge and tracker
Name both adapters in the configuration, forge and tracker, each { use: 'github', options }:
import { defineConfig } from '@microeinhundert/harness-kit';
/**
* GitHub as the forge and the tracker: pull requests and issues of one repository through the GitHub CLI, with two
* label-backed statuses an open issue moves through, and the hand-off checks that read them; `status-sync` reads the
* issue number from a branch such as `feat/12-checkout`.
*/
export default defineConfig({
adapters: {
forge: {
options: {
repository: 'acme/storefront',
},
use: 'github',
},
tracker: {
options: {
repository: 'acme/storefront',
statuses: [
{
category: 'in_progress',
labels: ['in progress'],
name: 'In Progress',
state: 'open',
},
{
category: 'in_progress',
labels: ['in review'],
name: 'In Review',
state: 'open',
},
],
},
use: 'github',
},
},
policies: [
{
id: 'pull-request',
use: 'pull-request',
},
{
id: 'status-sync',
options: {
branchKey: '^[^/]+/([0-9]+)',
roles: [
{
role: 'in_flight',
status: 'In Progress',
},
{
role: 'first_review',
status: 'In Review',
},
],
},
use: 'status-sync',
},
{
id: 'forge-guard',
use: 'forge-guard',
},
],
});status-sync finds an issue by the key in the branch's name, and by default it looks for a Jira-style key such as WEB-12. GitHub issues have numbers, so set branchKey to a pattern that reads the number, as above for branches such as feat/12-checkout. Without it, status-sync finds no issue and lets every stop through.
Check them. harness-kit config check asks each adapter what it can do and which account it is signed in as, which proves the credentials:
npx harness-kit config checkIf a step fails, see If something goes wrong.
Use the tracker from the command line
harness-kit tracker gives the agent, and you, the configured tracker with checked arguments. An issue key is its number, 12 or #12:
npx harness-kit tracker show 12 --comments
npx harness-kit tracker count "is:open label:bug"
npx harness-kit tracker transition 12 "In Review"The exit code is 0 when the command is done, 1 when the tracker refused it, and 2 for a usage or setup problem.
explain never writes
harness-kit explain, the tracker refuses every operation that would change an issue.If something goes wrong
ghis missing or signed out. The adapter reports a setup failure that names the problem. Installghand rungh auth login, or setGH_TOKEN. A Policy that needed the answer follows its fail mode.- A call fails. The adapter reports one of the protocol's kinds: not found (404), not allowed (401, 403), invalid, or a network problem. A 401 or 403 means the signed-in account lacks access to the repository.
- A call takes too long. One
ghcall may take 10 seconds; raisetimeoutMillis.
Troubleshooting lists more.
Options and behaviour
Related
- Stop checks and hand-off: the checks that read the forge and the tracker.
- Jira: Jira Cloud as the tracker.