Connect GitHub Copilot using a classic token
Connect GitHub Copilot to LinearB using a classic Personal Access Token to measure Copilot adoption and accepted lines of code across your organizations.
Overview
Connect GitHub Copilot to LinearB using a classic Personal Access Token (PAT) to collect Copilot adoption and accepted-lines data across your GitHub organizations.
Use this connection when your organization permits classic PATs and you need to include one or more GitHub organizations accessible to the token owner.
Data Provided by GitHub Copilot
Depending on the data returned by GitHub, the connection can provide:
- Copilot adoption
- Active Copilot users
- Code suggestions and acceptances
- Accepted lines of code
- Adoption trends across teams and organizations
Adoption and accepted-lines data appears in AI Analytics.
Historical Data and Collection Cadence
- Up to 90 days of historical Copilot data can be backfilled during the initial connection.
- Activity outside the available backfill window does not appear in LinearB during the initial import.
- After the initial connection, Copilot data is updated daily.
Before You Begin
Verify that you have:
- Access to AI Tools settings in LinearB.
- Permission to create a classic Personal Access Token in GitHub.
- Access to the GitHub organizations you want to include.
- GitHub Copilot usage metrics enabled for the relevant organizations.
Enable Copilot Usage Metrics in GitHub
In each GitHub organization you want to connect, confirm that the policy allowing access to Copilot usage metrics is enabled.
If the policy is disabled:
- LinearB cannot retrieve Copilot usage data.
- The integration may return a 403 authorization error.
- Copilot metrics do not appear in LinearB.
Create a Classic Personal Access Token
- Sign in to GitHub as the user who will own the token.
- Open your GitHub settings.
- Go to Developer settings → Personal access tokens → Tokens (classic) .
- Generate a new classic token.
- Enter a descriptive name, such as LinearB Copilot Integration.
- Set an expiration that complies with your organization’s security policy.
-
Select the following scopes:
read:userread:org
- Generate the token.
- Copy and securely store it.
Connect GitHub Copilot in LinearB
- Go to Settings → Company Settings → AI Tools → Integrations.
- Click Add New.
- Select GitHub Copilot.
- Click Continue.
- Select Classic token.
- Click Continue.
- Paste the classic PAT into the Token field.
-
Select how LinearB should include organizations:
- Select organizations manually
- Select organizations by regex
- Include all organizations
- Configure the selected organization scope.
- Click Connect.
LinearB validates the token, organization access, and Copilot permissions. When validation succeeds, the integration appears in the Connected list.
Choose an Organization Scope
Select Organizations Manually
Choose individual organizations from those accessible to the token owner.
Select Organizations by Regex
Enter a regular expression that matches the organization names you want to include.
Include All Organizations
Include every organization accessible to the token owner.
Verify the Connection
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select GitHub Copilot — Classic token.
- Confirm that the integration status is Connected.
- Review the selected organization scope.
- Allow time for the initial historical import and daily processing.
- Open AI Analytics and confirm that Copilot data appears.
Edit the Classic Token Integration
Use Edit mode to replace the token or change the organizations included in the integration.
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select GitHub Copilot — Classic token.
- Under Main Settings, click Edit.
- Update the classic PAT or organization-selection settings.
- Click Save changes to apply the update or Cancel to discard it.
What happens to historical data?
Editing the integration does not delete previously collected Copilot metrics.
- Token-only changes are picked up during scheduled daily collection.
- Changing the organization selection can trigger recollection of up to 90 days of recent data.
- Recollected records are updated in place and are not counted twice.
- Data older than the recollection window remains unchanged.
- Removing an organization from the selection does not delete metrics that were already collected for that organization.
Disconnect or Reconnect
Disconnecting the integration stops new data collection and moves it to the Disconnected list. Previously collected data is preserved.
Disconnect the integration
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select GitHub Copilot — Classic token.
- Click Disconnect.
- Confirm the action.
Reconnect the integration
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Disconnected.
- Select GitHub Copilot — Classic token.
- Click Reconnect.
- Enter a replacement classic PAT if the saved token has expired or been revoked.
- Complete validation to restore the integration.
LinearB validates the token and saved configuration before restoring the connection.
Learn more:
Troubleshooting
403 AiMetricsUnauthorizedException
- Confirm that Copilot usage metrics are enabled in GitHub.
- Verify that the token owner can access the selected organization.
- Confirm that the token contains the required scopes.
Connection Error
- Confirm that the PAT is valid and has not expired or been revoked.
- Verify that it is a classic PAT.
-
Confirm that it includes
read:userandread:org. - Verify that the token owner can access the selected organizations.
- Select the integration, click Edit, correct the configuration, and click Save changes.
Expected Organizations Are Missing
- Confirm that the token owner belongs to or can access the missing organizations.
- Verify that the token is authorized for organizations that use SAML single sign-on, where applicable.
- Review the manual or regular-expression organization selection.
No Copilot Data Appears
- Allow time for the initial import and daily processing.
- Confirm that developers are actively using Copilot.
- Verify that the expected organizations are included.
- Confirm that GitHub users are mapped to the appropriate LinearB users.
Learn more:
Known Limitations
- Copilot data is updated daily, not in real time.
- Historical activity outside the available initial backfill window is not imported during the first connection.
- Available metrics depend on the data returned by GitHub.
- Model, token, and estimated-consumption data is not currently available.
Related Articles
How did we do?
Connect GitHub Copilot Enterprise on ghe.com
Connect GitHub Copilot using a fine-grained token