# Turn a Linear label into a PR

Returns: A PR linked to the issue. Starts: on an event.

Label a Linear issue and an agent picks it up, does the work in the Project's repository and opens a pull request.

## Best for

- Teams that triage in Linear
- Small, well-described issues

## Uses

- A Linear connection
- A connected GitHub repository
- An automation with a Linear trigger

## The automation

Prompt: Do the work this Linear issue describes and open a pull request that links back to it. Ask on the issue if the description is not enough.

Trigger:

```json
{
  "kind": "linear",
  "events": [
    "linear.issue.labeled"
  ],
  "config": {
    "labels": [
      "agent"
    ]
  }
}
```

## While it works

Live stream events (`GET /o/{org}/sessions/{session}/events`):

- `thinking`: ENG-42 asks for a dark mode toggle in settings.
- `tool_use`: edit · settings/Appearance.tsx
- `tool_result`: build passed
- `message`: Opened a pull request that links ENG-42.

## What comes back

- `status`: completed
- `branch`: rush/eng-42-dark-mode
- `pr_url`: github.com/acme/web/pull/…

## Steps

1. **Connect Linear.** Sign in to Linear once from Settings, Integrations.
2. **Add the trigger.** A `linear` trigger on `linear.issue.labeled` with the labels that should fire it. Changes made by an app integration never fire.
3. **Label an issue.** The run starts with the issue as its context and opens a pull request on its own branch.

Field names are the API's; the values are an example.
