Connect GitHub Copilot using a fine-grained token
Connect GitHub Copilot to LinearB using a fine-grained Personal Access Token with narrowly scoped, read-only access to one GitHub organization.
Overview
Connect GitHub Copilot to LinearB using a fine-grained Personal Access Token (PAT) to collect Copilot adoption and accepted-lines data from one GitHub organization.
Use this connection when your organization requires more restrictive token permissions than a classic PAT provides.
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 for the connected organization
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.
- Organization owner or equivalent administrative access in GitHub.
- Permission to create a fine-grained PAT for the organization.
- Copilot usage metrics enabled for the organization.
- A GitHub organization role that grants the token owner permission to view organization Copilot metrics.
Enable Copilot Usage Metrics in GitHub
Confirm that the GitHub organization allows access to Copilot usage metrics.
If Copilot usage metrics are not enabled:
- LinearB cannot retrieve Copilot usage data.
- The integration may return a 403 authorization error.
- Copilot metrics do not appear in LinearB.
Grant the Token Owner Access to Copilot Metrics
The GitHub user who creates the fine-grained PAT must have an organization role that includes permission to view organization Copilot metrics.
Create the Organization Role
- In GitHub, open the organization.
- Go to Settings → Organization roles.
- Click Create role.
- Enter a descriptive name, such as Copilot View.
- Select the permission to view organization Copilot metrics.
- Save the role.
Assign the Role
- Open Organization roles → Role assignments.
- Select the role that grants access to Copilot metrics.
- Assign it to the GitHub user who will create and own the fine-grained PAT.
Create a Fine-Grained Personal Access Token
- Sign in to GitHub as the user who has the required organization role.
- Open your GitHub settings.
- Go to Developer settings → Personal access tokens → Fine-grained tokens .
- Click Generate new token.
- Enter a descriptive name, such as LinearB Copilot Integration.
- Set an expiration that complies with your organization’s security policy.
- Set the Resource owner to the organization whose Copilot data you want to collect.
- Configure repository access as required by your organization’s policy.
-
Under Organization permissions, grant:
- Organization Copilot metrics: Read-only
- Members: Read-only
- Generate the token.
- If organization approval is required, wait for the token to be approved.
- Copy and securely store the token.
Connect GitHub Copilot in LinearB
- Go to Settings → Company Settings → AI Tools → Integrations.
- Click Add New.
- Select GitHub Copilot.
- Click Continue.
- Select Fine-grained token.
- Click Continue.
- Paste the fine-grained PAT into the Token field.
- Click Connect.
LinearB validates the token, organization access, and Copilot permissions. When validation succeeds, the integration appears in the Connected list.
Verify the Connection
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select GitHub Copilot — Fine-grained token.
- Confirm that the integration status is Connected.
- Allow time for the initial historical import and daily processing.
- Open AI Analytics and confirm that Copilot data appears.
Edit the Fine-Grained Token Integration
Use Edit mode to replace the fine-grained PAT without disconnecting the integration.
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Connected.
- Select GitHub Copilot — Fine-grained token.
- Under Main Settings, click Edit.
- Update the fine-grained PAT in the Token field.
- 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.
- Saving a token change triggers a new collection.
- LinearB recollects up to 90 days of recent Copilot data.
- Recollected records are updated in place and are not counted twice.
- Data older than the recollection window remains unchanged.
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 — Fine-grained token.
- Click Disconnect.
- Confirm the action.
Reconnect the integration
- Open Settings → Company Settings → AI Tools → Integrations.
- Select Disconnected.
- Select GitHub Copilot — Fine-grained token.
- Click Reconnect.
- Enter a replacement fine-grained 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.
- Verify that the token has read-only access to organization Copilot metrics.
- Confirm that the token owner has the required organization role.
Connection Error
- Confirm that the PAT is valid and has not expired or been revoked.
- Verify that the token has been approved by the organization, if approval is required.
- Confirm that the correct organization is set as the resource owner.
- Verify that Organization Copilot metrics and Members are both set to Read-only.
- Select the integration, click Edit, enter the replacement token, and click Save changes.
The Organization Role Is Missing
- Confirm that the organization role includes permission to view Copilot metrics.
- Verify that the role is assigned to the user who owns the token.
- Allow time for recent GitHub permission changes to take effect.
No Copilot Data Appears
- Allow time for the initial import and daily processing.
- Confirm that developers are actively using Copilot in the connected organization.
- Verify that GitHub users are mapped to the appropriate LinearB users.
Learn more:
Known Limitations
- A fine-grained PAT connects one GitHub organization.
- 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 using a classic token
Connect Kiro to LinearB