> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Turn labeled Linear issues into pull requests

> Set up a CodeRabbit automation that implements a fix and opens a GitHub pull request when a Linear issue gets the label you choose, then comments the pull request link on the issue.

Cloud Only (This feature is available on CodeRabbit Cloud only. It is not available on self-hosted CodeRabbit deployments.)

## What you get

When a Linear issue gets the label you choose, such as `ready-for-agent`, CodeRabbit implements a focused fix, runs the relevant tests, and opens one pull request in the GitHub repository you pick. The pull request has a summary, test evidence, and a link to the Linear issue, and CodeRabbit comments the pull request link with a one-line summary on the issue. It doesn't change issue fields or merge the pull request.

## Before you start

| Requirement | Who does it | Where |
| - | - | - |
| Linear connected. Linear requires a workspace admin connection with read, write, and admin access. | A CodeRabbit admin, signing in to Linear as a Linear workspace admin | [Connections](https://docs.coderabbit.ai/connections.md), or the prompt in the automation editor |
| The Linear connection in Base Scope or in the automation's agent scope | A CodeRabbit admin | [Connections and Base Scope](https://docs.coderabbit.ai/automations/destinations.md#connections-and-base-scope) |
| The CodeRabbit GitHub App installed and active on the repository | A GitHub organization owner | GitHub |
| The Automations Agent trial or paid Agent access. See [Who can use Automations](https://docs.coderabbit.ai/automations.md#who-can-use-automations). | A CodeRabbit admin | **Automations Agent usage** card on the Automations page |
| A Linear label for issues that are ready, such as `ready-for-agent` | A Linear member | Linear |

Once Linear is connected and in scope, any workspace member can create the automation.

## Set it up

**1. Open the template**

Open **Automations** > **Home** and select **Implement code changes** under **Templates**. On the **Implement PRs for labeled tickets** card, under **Choose your ticketing system**, choose **Linear** and select **Set up**. The editor opens with **Create PR from Linear issue** as the name, a Linear trigger on the `Issue.create` and `Issue.update` events, the agent instructions, and two targets.

**2. Choose the Linear connection and teams**

In the **Trigger** card, choose the Linear connection. Under **Linear teams**, keep **All public teams** or select the teams whose issues can start a run.

If the editor says the connection needs scope setup, select **Set up Base Scope** or **Configure Base Scope** and add the connection. You can't save the automation until then.

**3. Choose the label**

The **Filter** row is set to **Has label**. Under **Label name**, search for the label and pick it from your Linear labels, so create it in Linear first. The label is required.

**4. Review the agent instructions**

The template tells CodeRabbit to implement a focused fix, run the relevant tests, open one pull request in the selected repository, post the pull request link on the Linear issue, and not change issue fields or merge. Add what's specific to your code, such as the test command or directories it must not touch. See [Write agent instructions](https://docs.coderabbit.ai/automations/create.md#write-agent-instructions).

**5. Choose the repository**

In the GitHub repository target, choose the **Repository**. The picker lists only repositories where the CodeRabbit GitHub App is installed and active. The repository is required.

**6. Choose the Linear connection for the comment**

In the Linear target, choose the **Connection**. This target's instruction is fixed: post one comment with the pull request link and a one-line summary.

**7. Save**

Set the toggle next to the name to **Active** and select **Save automation**. CodeRabbit creates the Linear webhook, so there is nothing to set up in Linear.

A run starts when an issue in the selected teams is created with the label, or when an existing issue gets the label. Removing the label doesn't start a run. See [Managed webhooks](https://docs.coderabbit.ai/automations/triggers.md#managed-webhooks).

## Test it

Create a test issue in one of the selected teams, or open an existing one, and add the label. Keep the issue small and well described, so the first pull request is easy to review.

Every time an issue gets the label, a new run starts, including when you remove the label and add it again. A redelivery of the same event from Linear doesn't start a second run. See [Deduplication](https://docs.coderabbit.ai/automations/triggers.md#deduplication).

## Check the runs

Open the automation from **Automations** > **Home**. **Overview** > **Recent runs** shows the latest runs; select **View all**, or open **Run history**, and select **Open run** under **Previous runs** to see what a run did. See [Automation details](https://docs.coderabbit.ai/automations/manage.md#automation-details).

The run summary shows what CodeRabbit reported, and there is no separate column for the pull request. A successful run leaves:

* A pull request in the repository, opened by the CodeRabbit GitHub App, with a summary, test evidence, and a link to the Linear issue.
* A comment on the Linear issue with the pull request link and a one-line summary.

## Variations

* **Start on a status instead of a label.** Set the **Filter** row to **Has status** to start a run when an issue is created in a status or moves to it.
* **Jira or GitHub Issues.** On the same card, choose **Jira** or **GitHub Issues** to open the **Create PR from Jira issue** or **Create PR from GitHub issue** template. **Has status** isn't available for GitHub.
* **Several repositories.** An automation opens pull requests in one repository. For several repositories, create one automation per repository, each with its own label or Linear teams.
* **Triage first.** Let CodeRabbit comment a likely cause and fix on new issues, and add the label to the ones worth implementing. See [Triage new engineering tickets](https://docs.coderabbit.ai/automations/guides/triage-engineering-tickets.md).

## What's next

> [card] [Triage new engineering tickets](https://docs.coderabbit.ai/automations/guides/triage-engineering-tickets.md)
>
> Get a likely cause and suggested fix on every new issue before you label it.

> [card] [Automation destinations](https://docs.coderabbit.ai/automations/destinations.md)
>
> Learn how GitHub repository and connection targets deliver results.

> [card] [Manage and monitor automations](https://docs.coderabbit.ai/automations/manage.md)
>
> Follow runs, pause the automation, and control its spend.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.