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

# How Pull Requests Link to Linear Issues

> The evidence that links a GitHub pull request to a Linear issue, and how the link carries spend to projects and initiatives.

Agent Golf links a pull request to a Linear issue when the issue has a GitHub attachment for that pull request. Linear creates the attachment. Agent Golf reads it and adds no link of its own.

## How Linear attaches a pull request

The GitHub integration of Linear attaches a pull request to an issue when the issue ID, for example `PLAT-142`, is in the branch name or the title of the pull request. In the description, write a magic word before the issue ID, for example `Fixes PLAT-142`. Turn on the GitHub integration in your Linear workspace, so that Linear can see your pull requests. See [GitHub integration](https://linear.app/docs/github) in the Linear documentation.

You can also attach a pull request to an issue by hand in Linear. Agent Golf reads it the same way.

## The rules that Agent Golf uses

* Agent Golf reads only the GitHub attachments of an issue. It ignores other attachments.
* The attachment URL must be a pull-request URL: `https://github.com/<owner>/<repository>/pull/<number>`. Agent Golf ignores the rest of the path, the query, and the fragment after the number. A commit URL or a GitHub issue URL makes no link.
* Agent Golf matches the repository name without regard to case.
* One issue can link several pull requests, and one pull request can link several issues.
* Two attachments of one issue that name the same pull request make one link.
* When you remove the attachment in Linear, Agent Golf removes the link. When you change the attachment to another pull request, the link moves to that pull request.

Agent Golf does not read the branch name, the title, or the description of a pull request to find an issue. A pull request with an issue ID in its title, but no attachment in Linear, does not link.

## Repositories

Agent Golf finds the pull request of a link in the GitHub organizations that the workspaces of your organization [connected](https://docs.agent.golf/github/organization.md). When it finds the repository, it keeps the GitHub ID of the repository with the link, so a later rename of the repository keeps the link.

A link can name a pull request that Agent Golf does not have, for example in a repository that the Agent Golf GitHub App does not cover. Such a link adds no spend. When Agent Golf did not find the repository, the link matches the pull request by the repository name, so a rename of the repository breaks it.

## How a link carries spend

A linked pull request counts for its issue and for each issue, project, and initiative above it, each once. A milestone counts the pull requests that link directly to its issues. See [How Spend Counts](https://docs.agent.golf/linear/project-spend.md#the-roll-up).

A pull request with no link to an issue in a project or an initiative is unplanned. See [Unplanned spend](https://docs.agent.golf/linear/project-spend.md#unplanned-spend).

## Where you see the links

* The **Linear Issues** card of a pull request lists the issues that the pull request links to, with their projects and initiatives.
* The **Linear Issues** card of a session lists the issues that the pull requests of the session link to.
* The **Pull Requests** tab of a project lists its linked pull requests.
* The issue details on the roadmap list the pull requests and the sessions of an issue.


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