# Forest Infra – GitHub Branch State

> Forest Infra – GitHub Branch State is a paid API for AI agents from http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-02).

Checks whether a named branch exists in a public GitHub repository and returns its current head commit SHA without cloning.

## Facts

- Endpoint: POST https://http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run/repo/branch-state?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/forest-infra-github-branch-state-8a54b7aa
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_b63vnjd-JseMdc0JnypyW

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability forest-infra-github-branch-state-8a54b7aa -d '<json body>'
```

Example prompt: Does the branch feature/payment-v2 still exist in the repo acme-corp/backend, and if so what's its current head commit?

## When to prefer this

Use this endpoint when you need a fast, lightweight check of a GitHub branch's existence and current head commit without the overhead of cloning or authenticating. Ideal for CI/CD pipelines, agent workflows that gate on branch state, or any scenario where you need to verify a branch tip on a public repository cheaply. Prefer this over full Git clone operations or heavier GitHub API wrappers when you only need branch existence and the latest commit SHA.

## Known failure modes

- Branch does not exist — returns existence false with no commit data
- Repository not found or is private — API cannot access it and returns an error or empty result
- Malformed repository string (not owner/name pattern) — rejected by input validation
- Branch name exceeds 256 characters — rejected by schema validation
- GitHub API rate limiting — may result in transient errors or delayed responses

## How this service works

Resolve whether a public GitHub branch exists and return its current head commit without cloning. Branch protection is null when the public API does not expose it. Base mainnet USDC

## Output

Returns whether the specified branch exists in the public GitHub repository, the current head commit SHA for that branch, and a null branch protection field (since the public GitHub API does not expose protection rules without authentication).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "branch": {
   "type": "string",
   "maxLength": 256,
   "minLength": 1,
   "description": "Repository branch whose current state should be checked."
  },
  "repository": {
   "type": "string",
   "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
   "maxLength": 200,
   "description": "Public owner/name repository to inspect."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/forest-infra-github-branch-state-8a54b7aa/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run](https://www.zero.xyz/host/http--forest-gas-station-mainnet--lcjl27p8lmjs.code.run/llms.txt)
