---
title: Link Pull Requests to Error Tracking Issues
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > Error Tracking > Link Pull Requests to Error Tracking Issues
---

# Link Pull Requests to Error Tracking Issues

## Overview{% #overview %}

Link GitHub pull requests to Error Tracking issues and track the full life cycle of an error, from detection to resolution. This link enables Datadog to automatically resolve the Error Tracking issue when the associated PR is merged.

With linked pull requests, you can:

- **Track issue resolution**: See which pull requests are addressing an Error Tracking issue directly from the issue panel.
- **Automatically resolve issues**: When a linked pull request is merged, Datadog automatically moves the issue to `Resolved` status.

## Prerequisites{% #prerequisites %}

- Install [the GitHub integration](https://docs.datadoghq.com/integrations/github.md) with read permissions for pull requests.
- Enable [Source Code Integration](https://docs.datadoghq.com/integrations/guide/source-code-integration.md) so that Datadog can process GitHub webhooks and link pull requests to Error Tracking issues.
- Verify that you have the [**Error Tracking Issue Write** permission](https://docs.datadoghq.com/account_management/rbac/permissions.md#error-tracking). This is required to link your PRs to Error Tracking issues.

## Link and manage pull requests{% #link-and-manage-pull-requests %}

### Link a pull request to an issue{% #link-a-pull-request-to-an-issue %}

To link a pull request to an Error Tracking issue:

1. Navigate to [Datadog Error Tracking](https://app.datadoghq.com/error-tracking).
1. Select the issue you want to link to open its side panel.
1. In the top right corner, click the **Actions** dropdown, then select **Link a Pull Request** to copy the issue URL.
1. Open your GitHub pull request and paste the issue URL into the description.

{% image
   source="https://docs.dd-static.net/images/error_tracking/pull-request-add.624bcaea40fc7a11c81d95fb52e6e71a.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/error_tracking/pull-request-add.624bcaea40fc7a11c81d95fb52e6e71a.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Link a pull request to an Error Tracking issue" /%}

Datadog detects the issue URL and automatically creates the link.

{% alert level="info" %}
Updating a pull request description to add or remove issue URLs automatically updates the link.
{% /alert %}

### View linked pull requests{% #view-linked-pull-requests %}

To view linked pull requests:

1. Navigate to [Datadog Error Tracking](https://app.datadoghq.com/error-tracking).
1. Select the issue you want to link to open its side panel.
1. In the top right corner, click the **Actions** dropdown to see the linked PR under **PULL REQUESTS**.
   {% image
      source="https://docs.dd-static.net/images/error_tracking/pull-request-find.4e1a4b75c5bfd2e95e7947c250a51400.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/error_tracking/pull-request-find.4e1a4b75c5bfd2e95e7947c250a51400.png?auto=format&fit=max&w=850&dpr=2 2x"
      alt="View pull requests linked to an Error Tracking issue" /%}

### Unlink a pull request{% #unlink-a-pull-request %}

To unlink a pull request from an issue, open the GitHub pull request and remove the Error Tracking issue URL from the description.

## Automatic state changes{% #automatic-state-changes %}

Linked pull requests trigger automatic issue state transitions:

| Initial state         | Action                               | Resulting state           |
| --------------------- | ------------------------------------ | ------------------------- |
| Issue is `For Review` | A PR is linked to the issue          | Issue moves to `Reviewed` |
| Issue is `Reviewed`   | A linked PR is merged                | Issue moves to `Resolved` |
| Issue is `Resolved`   | A linked PR is reopened              | Issue moves to `Reviewed` |
| Issue is `Resolved`   | A new open PR is linked to the issue | Issue moves to `Reviewed` |

{% alert level="info" %}
If an issue is linked to multiple pull requests, the issue moves to `Resolved` only when the last open (non-closed, non-merged) PR is merged.Closing a PR without merging does not resolve the issue.
{% /alert %}

## Further reading{% #further-reading %}

- [Issue States in Error Tracking](https://docs.datadoghq.com/error_tracking/issue_states.md)
- [Suspect Commits](https://docs.datadoghq.com/error_tracking/suspect_commits.md)
- [Source Code Integration](https://docs.datadoghq.com/integrations/guide/source-code-integration.md)
