Copilot usage metrics API adds user pull request activity

The user-level 1-day and 28-day reports in the Copilot usage metrics API now include pull request activity for enterprises and organizations. Each user row includes a pull_requests object showing how many pull requests that user created, reviewed, and merged, and how much of that work involved Copilot cloud agent and Copilot code review.

What's new

  • total_created : Pull requests the user created on the day. Pull requests created by Copilot cloud agent count for the user who started the agent.
  • total_created_by_copilot : The subset oftotal_created that Copilot cloud agent created for the user.
  • total_reviewed : Pull requests the user reviewed on the day, not counting their own.
  • total_reviewed_by_copilot : The user's pull requests that were reviewed by Copilot code review on the day.
  • total_merged : The user's pull requests merged on the day.
  • total_merged_created_by_copilot : The subset oftotal_merged that Copilot cloud agent created.
  • total_merged_reviewed_by_copilot : The subset oftotal_merged that was reviewed by Copilot code review.

Why this matters

Pull request metrics were only available in aggregate enterprise, organization, and repository reports. Per-user counts let you compare pull request throughput and Copilot-assisted work across users and teams without combining data from separate API calls.

Important notes

  • Scope: User-level 1-day and 28-day reports for enterprises and organizations. Field names match the existingpull_requests section in the aggregate reports.
  • Access: Available to enterprise owners and billing managers, organization owners, and anyone with a custom role that grants the "View Organization Copilot Metrics" or "View Enterprise Copilot Metrics" permission. The Copilot usage metrics policy must be enabled.
  • Copilot-active users only: Users appear in these reports only on days they used Copilot. Pull requests from bot accounts other than Copilot cloud agent aren't attributed to a user, while Copilot cloud agent pull requests are attributed to the user who started the agent. User totals can be lower than the enterprise or organization totals.
  • Reviews: A pull request with two reviewers counts once for each, so the sum oftotal_reviewed across users can exceed the aggregate.
  • No activity: Users with no pull request activity on a given day show zeros.
  • Not included: Median time to merge is available only in enterprise, organization, and repository reports.

To get started, see REST API endpoints for Copilot usage metrics.

原文来源:blog.github.com