Skip to main content

Check out Port for yourself ➜ 

GitHub Copilot

Loading version...

Port's Github Copilot integration allows you to ingest your Github Copilot usage metrics into your software catalog.

Deprecation Notice: Team Metrics

GitHub is sunsetting the legacy Copilot Metrics API on April 2, 2026.

  • The copilot-team-metrics resource will stop functioning after this date.
  • Team-level metrics are not supported in the new GitHub API. Users are advised to migrate to Organization-level metrics. See the Migration Guide below.

Prerequisites

GitHub token

Port's GitHub Copilot integration requires a classic GitHub token generated by organization owners or parent enterprise owners and billing managers with at least one of the following scopes enabled:

  • manage_billing:copilot
  • read:org
  • read:enterprise

In addition, the Copilot Metrics API access policy must be enabled for the organization within GitHub settings.

Setup

Choose one of the following installation methods: Not sure which method is right for your use case? Check the available installation methods.

Configuration

Port integrations use a YAML mapping block to ingest data from the third-party api into Port.

The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.

Default mapping configuration

This is the default mapping configuration for this integration:

Default mapping configuration (Click to expand)
entityDeletionThreshold: 0
resources:
- kind: copilot-team-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__team.slug + "@" + .date)
title: (.__team.slug + " copilot-metrics " + .date)
blueprint: '"github_copilot_usage"'
properties:
record_date: .date + "T00:00:00Z"
breakdown: .
total_suggestions_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_suggestions] | map(select(. != null) ) | add'
total_acceptances_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_acceptances] | map(select(. != null)) | add'
total_lines_suggested: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_suggested] | map(select(. != null)) | add'
total_lines_accepted: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_accepted] | map(select(. != null)) | add'
total_active_users: .total_active_users
total_chat_acceptances: |-
[
(.copilot_ide_chat.editors[]?.models[]?.total_chat_copy_events // 0),
(.copilot_ide_chat.editors[]?.models[]?.total_chat_insertion_events // 0)
] | map(select(. != null)) | add
total_chat_turns: '[.copilot_ide_chat.editors[]?.models[]?.total_chats // 0] | map(select(. != null)) | add'
total_active_chat_users: '[.copilot_ide_chat.editors[]?.total_engaged_users // 0] | map(select(. != null)) | add'
git_hub_org: .__organization.login
git_hub_team: .__team.slug
- kind: copilot-organization-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .date)
title: (.__organization.login + " copilot-metrics " + .date)
blueprint: '"github_copilot_usage"'
properties:
record_date: .date + "T00:00:00Z"
breakdown: .
total_suggestions_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_suggestions] | map(select(. != null) ) | add'
total_acceptances_count: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_acceptances] | map(select(. != null)) | add'
total_lines_suggested: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_suggested] | map(select(. != null)) | add'
total_lines_accepted: '[.copilot_ide_code_completions.editors[]?.models[]?.languages[]?.total_code_lines_accepted] | map(select(. != null)) | add'
total_active_users: .total_active_users
total_chat_acceptances: |-
[
(.copilot_ide_chat.editors[]?.models[]?.total_chat_copy_events // 0),
(.copilot_ide_chat.editors[]?.models[]?.total_chat_insertion_events // 0)
] | map(select(. != null)) | add
total_chat_turns: '[.copilot_ide_chat.editors[]?.models[]?.total_chats // 0] | map(select(. != null)) | add'
total_active_chat_users: '[.copilot_ide_chat.editors[]?.total_engaged_users // 0] | map(select(. != null)) | add'
git_hub_org: .__organization.login
- kind: organization-usage-metrics
selector:
query: 'true'
port:
entity:
mappings:
identifier: (.__organization.login + "@" + .day)
title: (.__organization.login + " copilot-metrics " + .day)
blueprint: '"githubCopilotOrganizationUsage"'
properties:
record_date: .day + "T00:00:00Z"
daily_active_users: .daily_active_users
code_generation_activity_count: .code_generation_activity_count
code_acceptance_activity_count: .code_acceptance_activity_count
loc_suggested_to_add_sum: .loc_suggested_to_add_sum
loc_added_sum: .loc_added_sum
user_initiated_interaction_count: .user_initiated_interaction_count
git_hub_org: .__organization.login

Mapping & examples per resource

To view and test the integration's mapping against examples of the third-party API responses, use the jq playground in your data sources page. Find the integration in the list of data sources and click on it to open the playground.

Monitoring and sync status

To learn more about how to monitor and check the sync status of your integration, see the relevant documentation.

Migration Guide

This guide walks you through migrating from the legacy copilot-organization-metrics kind to the new organization-usage-metrics kind before the GitHub API sunset on April 2, 2026.

What's changing

  • The copilot-organization-metrics kind is replaced by organization-usage-metrics, which uses a new blueprint (githubCopilotOrganizationUsage) and features a restructured schema.
  • GitHub is discontinuing support for team-level metrics. As a result, the copilot-team-metrics kind will stop working after the sunset date. There is no replacement for this functionality in the new API or the integration.

Migrate from copilot-organization-metrics

1. Add the new blueprint

Ensure you have the githubCopilotOrganizationUsage blueprint in Port. You can find the blueprint definition in the Organization usage metrics section above.

2. Add the new integration mapping

In your Port data source configuration, add the organization-usage-metrics kind. You can find the full mapping in the organization-usage-metrics resource section above.

3. Verify token permissions

Ensure your GitHub token has at least one of the following scopes: manage_billing:copilot, read:org, or read:enterprise, and that the Copilot Metrics API access policy is enabled in your GitHub organization settings.

4. Remove legacy kinds

Once data is flowing correctly via organization-usage-metrics, remove both copilot-organization-metrics and copilot-team-metrics from your mapping. Note that copilot-team-metrics has no replacement — it is simply being removed.

Existing entities

Entities already ingested under the github_copilot_usage blueprint will not be automatically deleted. A resync will auto-reconcile the environment.

Visualize GitHub Copilot metrics