Skip to content
Merged
122 changes: 120 additions & 2 deletions src/content/docs/factories/integrations/github.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,127 @@
---
title: Connect GitHub to your factory
description: >-
GitHub integration documentation for Warp Factories will be added in a follow-up PR.
Connect a factory to GitHub so issues, pull requests, reviews, and CI events
start factory work and results post back to GitHub.
sidebar:
label: "GitHub"
topic: factories
---
import { VARS } from '@data/vars';

GitHub integration documentation for Warp Factories will land in a follow-up PR.
When you connect a factory to GitHub, repository activity starts work in your factory. Issues, pull requests, reviews, and CI events can all trigger automations, and the factory posts results back to GitHub as comments, branches, and pull requests.

## Prerequisites

* **The Warp GitHub App** - Follow the [GitHub integration setup](/platform/integrations/github/) if you haven't already. One installation serves both the platform integration and factories.
* **A factory with GitHub repositories** - The app must have access to at least one of the factory's repositories.

## Connect GitHub to a factory

1. In the {VARS.FACTORY_WEB_APP} at <a href={VARS.FACTORY_WEB_APP_URL}>platform.warp.dev</a>, click **+** next to **Factories** to open the setup wizard, then choose **I want to use repos from GitHub** under **Connect your code host**.
Comment thread
hongyi-chen marked this conversation as resolved.
2. Under **Select your repos**, choose the repositories to provide code and context for the factory.
3. In the factory's [control room](/factories/control-room/), click **Automations**. Create an automation or edit a default one, choose the receiving agent, and add any **Additional instructions**.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We populate default github automations on factory creation - so this is technically not required (or could maybe be it's own section for adding automations in general?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, and I think the old shape was worse than just redundant — it was misleading. A seven-step procedure where five of the steps build an automation by hand implies the factory sits idle until you configure a trigger, when it's actually already listening the moment you connect.

Restructured in #562 along the lines you suggested:

  • Connect GitHub to a factory is now the two steps it actually takes, followed by what the two seeded defaults already do and a one-line way to verify (mention the factory on a test issue, watch for a work item).
  • Add a custom automation is its own section, framed for the cases the defaults don't cover, like a failed CI run or a review request.

I confirmed the seeding claim against githubSeedAutomations in logic/factorysource/defaults/automations.go before rewording, so the page now matches when those automations actually appear.

4. Under **Triggers**, click **Add trigger**.
5. Choose **GitHub**, then choose an event.
6. Select a repository, then use **More filters** to narrow which activity matches.
7. Click **Save**. To confirm the automation works, trigger a matching event in GitHub, such as opening a test issue, and check that a work item starts in the control room.

Managed GitHub factories start with two editable default automations. The first handles agent mentions and assignments (see [Mention the factory](#mention-the-factory)). The second runs when a pull request closes or merges: on a merge it finds the work items linked from the pull request and moves each one to its tracker's completed state, and on a close without a merge it does nothing.

## Supported triggers

<table>
<colgroup>
<col style="width: 22%" />
<col />
</colgroup>
<thead>
<tr><th>Trigger</th><th>Supported activity</th></tr>
</thead>
<tbody>
<tr><td>Issues</td><td>Created, labeled, assigned, or agent mentioned</td></tr>
<tr><td>Pull requests</td><td>Opened, marked ready, reopened, updated with commits, assigned, labeled, mentioned, closed, or merged</td></tr>
<tr><td>Reviews</td><td>Review requested or review submitted</td></tr>
<tr><td>Code and CI</td><td>Push, completed check suite or workflow run, or a re-requested Warp-owned check</td></tr>
</tbody>
</table>

Re-requesting a check triggers the factory only when the Warp GitHub App created that check. GitHub doesn't deliver re-request events for third-party CI checks.

### Automation filters

Every trigger names the repository it watches. The remaining filters appear only on the event types they apply to:

| Filter | Matches | Appears on |
| --- | --- | --- |
| **Branches** | The pushed branch, or a CI run's head branch | Push and CI triggers |
| **Base branches** | The branch the pull request targets | Pull request triggers |
| **Paths** | The files the change touches | Push and pull request triggers |
| **Labels** | Labels on the issue or pull request | Issue, pull request, review submitted, and CI triggers |
| **Authors** | Who opened the issue or pull request | Issue, pull request, and CI triggers |
| **Assignees** | Who the issue or pull request is assigned to | Issue and pull request triggers |
| **Mentioned users or teams** | Which user or team is @mentioned | Mention and review submitted triggers |
| **Reviewers** and **Reviewer teams** | Who review was requested from | Review requested triggers |
| **Review states** | Whether the review approved, requested changes, or commented | Review submitted triggers |
| **Workflows** | The GitHub Actions workflow, by name | Workflow run triggers |
| **Conclusions** | The run's result: success, failure, cancelled, and so on | Check suite and workflow run triggers |

CI payloads don't carry issue or label data, so on check suite and workflow run triggers, **Labels** and **Authors** match against the pull request linked to the run.

Use filters to route work precisely. For example, send failed runs of a specific workflow to a CI-repair automation.

## Mention the factory

A factory doesn't get its own GitHub handle. Every factory listens through the same Warp agent account, **@oz-agent**, and the factory's `factory:<alias>` label decides which factory a mention reaches:
Comment thread
hongyi-chen marked this conversation as resolved.

1. Apply the factory's `factory:<alias>` label to the issue or pull request. Warp creates the label in each connected repository.
2. Assign **@oz-agent** to the issue or pull request, or mention **@oz-agent** in the body or in any new comment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to further confirm - this will/should be @warp-factory instead of oz-agent

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and changed to @warp-factory, in both this line and the assign/mention step below it. Since this PR had already merged, it landed in #562.

Thanks for pushing on this — Rachael raised the same doubt earlier and I initially told her @oz-agent was correct, because it is what production resolves to today (config/github.go defaults to it, and only local.yaml and staging.yaml override). What I'd missed was warp-server#15306, which gives factories their own permanently separate handle: FactoryGitHubHandle() is documented as "permanently distinct from GitHubAgentHandle(): callers pick whichever applies, never fall back between them", and githubSeedAutomations materializes it into the seeded mention and assignment filters.

One thing worth flagging: #15306 is still an open draft and now has merge conflicts, and the behavior is gated behind a factory_github_handle flag. So the docs now lead the server. That's harmless while #508 is unmerged and these pages aren't public, but #15306 needs to land before #508 reaches main, or the page will name a handle that doesn't answer. Flagging in case that ordering isn't already on someone's radar.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your GitHub account is not connected to Warp. Connect it here.


The default mentions-and-assignments automation starts a work item in the matching factory, and the factory replies in the same thread. The label is what routes the request. A mention without the factory's label doesn't match the default automation.

Mentions count only in new content; edits to existing comments, mentions inside code blocks, and mentions from bots are ignored.

The handle and label are default filter values, not fixed rules. Edit the automation's **Mentioned users or teams** filter to respond to other handles, such as your own `@org/team` slug, or remove the label filter to catch every mention in the factory's repositories.

## How the factory responds on GitHub

The factory posts progress comments in the originating issue, pull request, or review thread, with links to the run and to any branches or pull requests it creates. Events without a comment surface, such as a push or a workflow run, report their results on the work item instead.

New activity on an issue, pull request, or review thread the factory is already working on continues that work item instead of starting a new one.

Issues and pull requests created by the factory carry a `factory:<alias>` label. Warp adds that label to every connected repository and removes it when you disconnect a repository or delete the factory, so you never create it by hand. Both passes are best-effort: if GitHub rejects one, a stale label can linger and needs deleting manually.

Factory-created branches and pull requests follow the repository's normal rules: branch protection, required reviews, and merge requirements still apply.

## Permissions

Runs authenticate with the GitHub App installation, not with the account of the person whose activity triggered them:

* **The app installation decides what agents can reach.** Agents get exactly the repositories and permissions the installation grants. Factory repositories and automation filters control when work starts, not what a running agent can reach. To change access, change the installation.
* **Anyone who can create matching activity can start work.** The event author doesn't need to be a Warp team member. Use author, label, and branch filters to control what starts runs.

For the full credential model, see [Permissions and identity](/platform/integrations/github/#permissions-and-identity) on the GitHub integration page.

## Factory-definition pull request checks

If the factory's [definition is managed as code](/factories/factory-as-code/) in a GitHub repository, Warp reviews configuration changes like CI reviews code. When a pull request targets the production branch and changes files in the registered factory directory, a **warp/factory-config** check runs: it passes with a summary of the change, or fails with diagnostics on what to fix. Require the check in branch protection to block invalid definitions from merging.

These checks validate the factory's configuration files only. They don't create work items, and pull requests that don't touch the factory directory don't get the check.

## Troubleshooting

### A GitHub event doesn't start work

Confirm the app installation covers the event's repository, the repository belongs to the factory, and the automation includes that event. Then check each filter; a label, author, branch, workflow, conclusion, or state mismatch prevents routing.

### Filter options don't load

Select a repository first. If the automation editor shows **Connect GitHub**, complete the account connection and retry. You can enter a value manually when suggestions are unavailable.

### An agent can't push a branch or open a pull request

Check that the installation still covers the target repository and grants the required write permissions. Automation filters don't affect GitHub authorization.

### A factory-definition check doesn't appear

The check runs only for factories whose [definition is managed as code](/factories/factory-as-code/) in a GitHub repository. Confirm the pull request targets the definition's production branch, changes files under the registered factory directory, and that the GitHub App covers the repository.
Loading