# Customer-hosted runner

Run the migration in your own GitHub Actions with your own Claude or Codex key. PatchFlow keeps the evidence, the gate, and the draft PR.

With the customer-hosted runner, the coding agent runs in your repository's GitHub Actions, under your model account, with your repository's own permissions. PatchFlow never receives your model key, and no third-party coding-agent integration needs access to your repository.

PatchFlow still owns what makes the result trustworthy: the release evidence and prompt, a server-side check of the pushed branch, the draft pull request, and the readiness verdict from your required Checks on the exact head commit.

## Install

- Save https://patchflow.run/runner/patchflow-migrate.yml as .github/workflows/patchflow-migrate.yml on your default branch. Read it first; it is short.
- Add one repository secret: ANTHROPIC_API_KEY for Claude Code (default), or OPENAI_API_KEY for Codex and set the repository variable PATCHFLOW_AGENT to codex.
- Optional: set PATCHFLOW_MODEL to pin a model.
- Private npm packages: add the secret NPM_TOKEN and the variable NPM_REGISTRY_URL. Only the agent job can read them.
- In the pilot workspace, choose Your own GitHub Actions runner in step 2.
- Make sure every required Check runs on pull_request events. The runner pushes with your repository's GITHUB_TOKEN, and GitHub does not start push-triggered workflows for pushes made with that token, so only the pull request PatchFlow opens will run your CI.

```
curl -fsSL https://patchflow.run/runner/patchflow-migrate.yml \
  -o .github/workflows/patchflow-migrate.yml
```

## How a run works

- PatchFlow dispatches the workflow with the run id, the inspected commit, the branch name, and the migration prompt.
- The agent job checks out the inspected commit with a read-only token, runs Claude Code or Codex with your key, and uploads a patch.
- The publish job never sees your model key and never runs agent code. It rejects changes under .github/ or above the file cap, then pushes only patchflow/<run id>.
- PatchFlow re-checks the branch on its side: it must descend from the inspected commit, stay inside the diff policy, and leave a root or workspace package.json that admits the target version. Only then does it open a draft pull request.
- Your required Checks run on that pull request (they must be triggered by pull_request). It is ready only when they pass on its exact head commit. Nothing merges automatically.

## What PatchFlow can and cannot see

- Sees: workflow run status, the pushed branch, its diff, and your Check results.
- Never sees: your model key, your npm token, or your model provider's bill. Cost in the Migration Proof Report shows as paid by you.
- The workflow is yours: you can change it, and PatchFlow treats whatever it pushes as untrusted until its own checks and your Checks pass.

## Limits

> Early access during the private pilot. Every action in the template is pinned to a commit SHA; review updates to the template like any other dependency change.
