---
title: Use Autopilot with GitHub
source: https://docs.newrelic.com/docs/agentic-ai/autopilot/use-autopilot-with-github
---

> #### 💡 PREVIEW
>
> We're still working on this feature, but we'd love for you to try it out!
>
> This feature is currently provided as part of a preview program pursuant to our [pre-release policies](https://docs.newrelic.com/docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy).

Once you [connect Autopilot to GitHub](https://docs.newrelic.com/docs/agentic-ai/autopilot/connect-to-github), GitHub context flows into investigations automatically. The examples on this page apply to all supported GitHub environments: public GitHub (`github.com`) and GitHub Enterprise Cloud (`YOURSUBDOMAIN.ghe.com`). You do not have to mention GitHub. When Autopilot finds a Change Tracking event with a commit SHA during an investigation, it fetches the associated Pull Request and surfaces it as part of the response.

## What you can do [#capabilities]

When Autopilot has GitHub access and a Change Tracking event with a commit SHA, it can:

-   **Link a deployment to a PR.** Given a commit SHA on a Change Tracking event, return the associated Pull Request (number, title, description, URL).
-   **Summarize what changed.** Report the files touched and the added/deleted line counts for the PR that shipped the incident-adjacent deployment.
-   **Answer follow-ups in the same investigation.** Once the PR is on the record, you can ask Autopilot to compare it to the previous deployment or to correlate the change with the failing signal.
-   **Run alert-triggered or manual investigations.** The GitHub lookup runs the same way whether Autopilot is triggered by an alert with an SRE destination or invoked manually from Slack or the AI Chat panel.

## Investigate an alert with deployment context [#alert-investigation]

When an alert with an SRE destination fires and Change Tracking has a matching event, Autopilot's investigation notes the PR that shipped the change and what it touched.

Illustrative example (not a real investigation):

> **You:** @New Relic why is `<service-name>` alerting?
>
> **Autopilot:** Error rate on `<service-name>` rose sharply around `<timestamp>`. A Change Tracking event a few minutes earlier corresponds to PR #`<number>` ("`<PR title>`") which touched `<N>` files in `<path>` (+`<additions>`/−`<deletions>` lines). Author: `<author>`. Link: github.com/`<owner>`/`<repo>`/pull/`<number>`.

## Ask follow-ups in the same thread [#follow-ups]

Continue in the same investigation thread. Autopilot keeps the PR and commit context on the record and can reason about it in follow-ups:

> **You:** @New Relic what was the deployment before that?
>
> **Autopilot:** [returns the previous Change Tracking event and, if present, the PR and commit that carried it]

## Manual investigations [#manual-investigations]

You can also trigger a GitHub-aware investigation manually from Slack or from the New Relic AI Chat panel. Reference the entity or the incident and ask Autopilot to investigate; the GitHub lookup runs the same way.

## How Autopilot uses GitHub data [#how-it-works]

When Autopilot identifies a Change Tracking event containing a commit SHA during an investigation, it uses the following GitHub MCP tools:

| Tool                   | What it does                                                                                                                                                                    |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pull_request_read`    | Fetches the associated Pull Request once a commit is matched — extracts the URL, title, description, and author to provide full deployment context for the root cause analysis. |
| `search_commits`       | Searches commits using the full SHA commit value.                                                                                                                               |
| `search_pull_requests` | Resolves Pull Request details — including links and metadata — by querying against the commit SHA and entity name.                                                              |
| `list_pull_requests`   | Retrieves recently merged Pull Requests from the repository to provide high-level summaries of code movement.                                                                   |
| `get_commit`           | Inspects the specific commit hash to surface the files changed and the addition/deletion line counts attributed to the deployment.                                              |
| `list_commits`         | Generates a chronological list of commits to help correlate specific merges with the timing of an incident.                                                                     |

Autopilot does the following:

-   Reads Pull Request metadata and commit change metadata (files changed, additions, deletions) from the commit SHA on the Change Tracking event.
-   Is subject to the permissions in the PAT and does not write PRs or comments, or take merge or approval actions.
-   Returns a synthesized summary of the PR and commit to the requesting user through the same response channel as the rest of the investigation.

> #### ⚠️ CAUTION
>
> Autopilot reads whatever GitHub returns for the linked commit — including the free-text PR description body and file change metadata (files changed, additions/deletions) from the Contents: Read scope. If a connected repository contains hardcoded credentials, API keys, secrets, or highly sensitive information in code files or PR descriptions, that content may flow into Autopilot's investigation context and may be saved.
>
> To reduce this risk:
>
> -   Do not connect repositories where credentials, keys, secrets, or highly sensitive information are committed directly to code or configuration files. Use the PAT's repository scope to exclude those repos (see [Step 1](https://docs.newrelic.com/docs/agentic-ai/autopilot/connect-to-github/#create-token)).
> -   Do not put credentials, secrets, API keys, highly sensitive information, or tokens in PR descriptions of connected repositories. If those are included in a PR description, revoke it and rewrite the PR description before enabling the integration on that repo.

> #### ⚠️ IMPORTANT
>
> Responses that include PR context are visible to the same audience as the rest of the investigation. If the investigation is running in a Slack thread, everyone in the thread sees the summarized PR details. Autopilot queries GitHub with the org-level token, but its replies are visible to whoever Autopilot is answering.

## Related articles [#related]

-   [Connect Autopilot to GitHub](https://docs.newrelic.com/docs/agentic-ai/autopilot/connect-to-github)
-   [Troubleshoot the GitHub connection](https://docs.newrelic.com/docs/agentic-ai/autopilot/troubleshoot-github-connection)
-   [Use Autopilot](https://docs.newrelic.com/docs/agentic-ai/autopilot/use-autopilot)
