Blog · Guide · 27 November 2026

GitHub Issue to Pull Request Agent: A Setup With Linear Too

The simplest GitHub issue to pull request agent setup is a label: someone adds agents to an issue, a workflow posts the issue to a webhook, a runner starts coding agents with the issue's title and body as their task, and the result is posted back on the issue. Linear works the same way with a Linear webhook in place of the workflow. This guide builds that with Forkit's factories: the webhook address and what it can and cannot do, how an issue becomes one work item, the runner that starts the agents on your machines, and the guards worth adding before you let any issue start work.

A note on names: Factory is also a company that sells coding agents. In this article a "factory" is Forkit's feature, a saved fan-out that can be run on request.

The GitHub issue to pull request agent pattern

  1. Trigger. A label on a GitHub issue, or an issue event in Linear.
  2. Ask. The event is posted to the factory's webhook address. That only asks for a run.
  3. Run. A runner your team operates picks up the waiting run and starts the agents, each with its own short-lived key and a prompt filled from the issue.
  4. Coordinate. The agents work like any fan-out: claims, messages, permission requests to the right person, a merge check, a budget.
  5. Report. The runner finishes the run and, for a GitHub issue, comments the result on it.

Forkit never runs an agent. Steps 3 and 5 happen on hardware you control, through forkit factory work or forkit daemon.

Step 1: make the factory

A factory holds the prompt template, how many agents, a repository, budgets and a time limit:

forkit factory create --name issues --prompt-file issue-prompt.md \
  --agents 1 --max-cost 5 --push

The prompt can use the issue's fields:

Fix GitHub issue #{{item.number}}: {{item.title}}

{{item.body}}

Issue: {{item.url}}. Work on a branch, run the tests, and summarise what you changed.

Creating the factory returns its webhook address once: https://forkit-mcp.com/hooks/factory/ft_…. Store it as a secret.

What the webhook token can and cannot do

The token (ft_ plus 48 hex characters, stored hashed) names the factory and can do one thing: ask for a run. It starts nothing by itself, returns no key and reads nothing. Each address takes 30 asks a minute, at most 25 runs wait per factory, and an input is at most 20,000 characters. Whatever JSON the caller sends becomes the run's input, so a leaked address costs you queued runs, not access. Delete the factory and make it again to change the address.

Step 2: reduce the issue to one item

GitHub and Linear send large event payloads. Forkit's webhook recognises a GitHub or Linear issue event and reduces it to one item with six fields: title, body, number, url, repo and labels. One issue becomes one item, so a run gets one agent, whatever the factory's agent count. For Linear, number is the identifier, such as ENG-42.

Step 3: wire GitHub

Forkit prints a ready workflow:

forkit factory template github issues > .github/workflows/forkit-agents.yml

The workflow it writes runs on issues events of type labeled, only when the label is agents, and posts the relevant part of the event to the address kept in the repository secret FORKIT_TRIGGER_URL:

on:
  issues:
    types: [labeled]
jobs:
  ask:
    if: github.event.label.name == 'agents'
    runs-on: ubuntu-latest
    steps:
      - name: Ask Forkit for a run
        env:
          FORKIT_TRIGGER_URL: ${{ secrets.FORKIT_TRIGGER_URL }}
        run: |
          jq '{action, label: {name: .label.name}, issue: {number: .issue.number, title: .issue.title, body: .issue.body, html_url: .issue.html_url, labels: .issue.labels}, repository: {full_name: .repository.full_name}}' "$GITHUB_EVENT_PATH" \
            | curl -fsS -X POST -H 'Content-Type: application/json' --data-binary @- "$FORKIT_TRIGGER_URL"

GitHub's docs list over twenty activity types for issues and note that "By default, all activity types trigger workflows that run on this event", which is why the workflow narrows it to labeled and checks the label. Without that, every edit and comment would ask for a run.

Step 3, Linear variant

forkit factory template linear issues

prints the steps: in Linear, Settings, API, Webhooks, New webhook, with the factory's address as the URL and Issues as the data change events. Linear's docs say "Only workspace admins, or OAuth applications with the admin scope, can create or read webhooks", so you may need an admin.

One difference matters. Linear sends data change events for create, update and remove, so a plain issue webhook fires on every update of every issue in scope. Point a label-filtered webhook or a Linear automation at the address instead, or the 25-run queue fills with edits. Linear also expects a 200 within 5 seconds and retries a failed delivery up to three times; Forkit's address answers at once because it only records the ask.

Step 4: run the runner

On a machine with your agent installed and signed in:

GITHUB_TOKEN=… forkit factory work issues \
  --exec "claude -p \"\$FORKIT_PROMPT\"" --repo-from ./app --comment

For each waiting run, the runner starts it (which creates the fan-out and returns each agent's key, prompt and title, once), runs the command per agent in an empty folder with FORKIT_API_KEY, FORKIT_URL, FORKIT_PROMPT, FORKIT_TITLE and FORKIT_AGENT set, pushes the repository from --repo-from for a factory with a pushed repository, and finishes the run. Use a full path for any script you pass to --exec, since each agent starts in its own empty folder.

--comment posts the run's result on the GitHub issue that asked for it, using GITHUB_TOKEN (and GITHUB_API_URL for GitHub Enterprise), or gh when no token is set. It works for GitHub issues only; a Linear run's result is on its threads and its fan-out page.

To serve every factory of the workspace from one machine, use forkit daemon --exec CMD instead. Running scheduled coding agents on your own machines covers the runner in depth.

Step 5: guard it

An issue tracker is a place anyone in the organisation can type into. Before letting issues start agents:

Guard How Why
Budget --max-cost USD on the factory The run stops at the budget (estimated from list prices)
Tool-call cap --max-tool-calls N For agents that do not report cost
Shadow run first --shadow Anything that would need a person is refused and listed, so you see what real runs would ask
Approved plan Workspace setting "require a plan" A run starts only when its input names an approved plan
Who can label Repository permissions The label is the trigger

The plan requirement is strong: with it on, an issue-triggered run is refused unless its input names a plan a person approved. That suits large issues and gets in the way of small ones, so many teams keep it for a separate factory. Shadow runs for coding agents explains how to read a shadow run's list.

Remember the prompt comes from the issue body. Treat it as untrusted text: production, secrets and money always go to a person in Forkit, and a fan-out agent with nobody answering is denied rather than left waiting.

How this compares with a hosted agent

Capy's Linear integration starts from delegation: "Delegating it to Capy, or mentioning @Capy in a comment, opens an agent session in Linear." Capy runs the agent in its own cloud, opens a pull request on GitHub, and posts progress in the Linear session; it never merges unless you ask. That is less to set up than the flow above: no runner, no workflow. If you want a hosted agent that takes a ticket and returns a pull request, Capy is the shorter path, and other hosted agents offer similar integrations.

The Forkit flow suits teams that want the agents to run on their own machines with their own subscriptions, want several agents or several vendors per issue, or want the same budgets, approvals and merge checks as their other agent work. Build a software factory and what is a software factory cover the wider pattern.

Plans and limits

Factories and webhooks are on every plan. Free includes one factory without a schedule and up to 12 agents in one fan-out; Pro ($20 a month) five factories with schedules; Team ($40 per seat a month) 50. Billing is per person, never per agent. More at forkit-mcp.com.

Checklist

  • Factory created; webhook address stored as a secret.
  • Prompt uses {{item.title}}, {{item.body}}, {{item.url}}.
  • GitHub workflow narrowed to the agents label, or a filtered Linear webhook.
  • Runner running with --comment and a full path in --exec.
  • Budget and tool-call cap set; one shadow run done.

Sources

Read on 27 Nov 2026: