---
title: "GitHub Copilot"
canonical: "https://support.appfire.com/space/FD/3074228249/GitHub%20Copilot"
format: markdown
---
> Macro (aura-html)

> ⚠️ Use a service account to create this integration. Learn more about <u>[creating service accounts](https://appfire.atlassian.net/wiki/spaces/FD/pages/1801977900)</u>. The service account must be a **maintainer** or **owner** at both the project and repository levels to utilize all services and webhooks.

## Authentication

Currently, Copilot integration supports authentication only through **GitHub Personal Access Tokens (PATs)**. Both **classic PATs** (**Organization**-managed and **Enterprise**-managed) and **fine-grained PATs **(**Organization**-managed) work; however, we recommend **classic PATs** when possible because they simplify permission scoping and reduce configuration issues.

Some organizations enforce short PAT expiration windows. This can introduce operational overhead, since expired tokens must be regenerated and re-added to the integration.

If your security policies allow it, you can extend the PAT expiration period to reduce this maintenance burden.

## Create your integration

To create your Copilot integration:

1. Click **Settings** in the top navigation.
2. In the left navigation under **Integrations**, click **Integrations**.
3. Click **Add integration**.
4. Click **Copilot** in the Integration Provider list.
5. <u>[Generate an access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)</u> (**Settings** > **Developer Settings** > **Personal access tokens** > **Tokens (classic)**).

- If your Copilot licenses are managed by your organization (**classic PATs** and **fine-grained PATs**), you will need to create a personal access token with the following scopes:
  - `read:org`
  - `manage_billing:copilot`
- If your Copilot licenses are managed by your enterprise (**classic PATs** only), you will need to create a personal access token with the following scopes:
  - `read:enterprise`
  - `manage_billing:copilot`

> ⚠️ Copilot has announced changes in some functionality with their APIs that will affect user PATs:
> ⚠️ 
> ⚠️ - Customers using a **classic** **PAT** for the Copilot integration do not need to make any changes.
> ⚠️ - Customers using a **fine-grained** **PAT** for the Copilot integration will need to enable a new permission in their PAT settings. You can do so by editing or creating a new fine-grained PAT. The following permissions are required:
> ⚠️   - **Organization**-managed:
> ⚠️     - `GitHub Copilot Business` OR `Administration`
> ⚠️     - `Organization Copilot metrics` (new)
> ⚠️   - **Enterprise-managed**:
> ⚠️     - **Enterprise-managed** **fine-grained** **PATs** are not supported. If you are are enterprise managed, you cannot use a fine-grained PAT for the Copilot integration.

> 📝 If you are unsure to which scopes you need, you can enable both the `read:org` and `read:enterprise` along with `manage_billing:copilot.`

6. Copy the access token and return to Flow.
7. Paste the token in the **Personal access token** field.
8. Paste the organization’s URL in the **Organization URL** field.

![Copilot integration authentication screen.](media://aa222163-22b5-4dce-9b0a-0f025c0639ae)

9. Click **Test connection**. If the connection was successful, you'll see the success message.
10. Click **Next**.
11. Name your integration. This is the name Flow will display for the integration. Choose a name that will help you identify the integration later.
12. Once you've completed all sections, click **Create**.

When you have successfully integrated Flow with Copilot, you can go to **Reports** > **Dashboards** > **AI activity dashboard** to view the [Copilot report](https://appfire.atlassian.net/wiki/spaces/FD/pages/3073769555).

> Macro (excerpt)
> 
> ## User mapping
> 
> Based on how GitHub Copilot and Flow structure developer identities, setting up user mapping prevents ghost or duplicate Flow profiles. This, in turn, prevents skewed metrics on your dashboards. 
> 
> GitHub Copilot tracks activity using individual GitHub usernames (for example, `doe-dev`), whereas your core repo and ticketing integrations (like Jira) primarily track engineers using corporate emails (like `john.doe@company.com`). 
> 
> Without mapping, Flow cannot connect these two distinct identities. It will treat them as separate entities, creating duplicate ghost profiles for the same human developer.
> 
> ### Configure user mapping: Prefixes and suffixes
> 
> When your [enterprise sets up GitHub Copilot](https://docs.github.com/en/enterprise-cloud@latest/admin/managing-iam/iam-configuration-reference/username-considerations-for-external-authentication), usernames are often auto-generated according to rigid formatting and normalization rules. 
> 
> Because of this automated logic, adding prefixes and suffixes in Flow acts as a pattern-matching translator. It reverses the platform's adjustments so Flow can identify, track, and auto-merge Copilot user activity with your primary developer profiles.
> 
> #### Prefix
> 
> When syncing thousands of employees from a corporate directory into GitHub, your IT (Identity Team) often uses custom rules or expressions to format usernames or to handle corporate domains.
> 
> - **What your IT does**: It might prefix usernames with a domain or region, like `US-johndoe` or `DEV-johndoe`.
> - **What is the problem**: The user’s primary engineering data will not have this enterprise tag. In their Git commits or Jira tickets, the username will be just `doe-dev`.
> - **How a prefix can help Flow: **You tell Flow: *"If you see *`US-`* or *`DEV-`* at the beginning of a GitHub username, ignore it so you can match the Copilot data to the correct developer.*
> 
> #### Suffix
> 
> - **What GitHub does**: GitHub (Enterprise) automatically appends an underscore and your enterprise's shortcode to the end of every externally authenticated username (for example, `john-doe_appfire`).
> - **What is the problem**: The user’s primary engineering data will not have this enterprise tag. In their Git commits or Jira tickets, the username will be just `john-doe`.
> - **How a suffix can help Flow**: By configuring `_appfire` as a suffix pattern in Flow, the platform strips that tracking tag from the incoming Copilot usage reports, matching `john-doe_appfire` straight back to the core identity of `john-doe` to auto-merge their analytics. In other words, you tell Flow: *"Hey, look out for *`_yourcompany`* at the end of usernames. Strip it off so you can auto-merge that Copilot activity into the real *`johndoe`* profile."*
> 
> To summarize, Copilot is just a passenger using the GitHub username. Because GitHub usernames get modified by automated enterprise onboarding, you define these prefix/suffix rules in Flow as a translator so Flow can say: *"Ah, so *`US-johndoe_appfire`* on this Copilot report is actually just *`johndoe`* in our engineering metrics. I will auto-merge them."*