In right now’s data-driven world, having insights into the utilization and efficiency of instruments like GitHub Copilot is essential for organizations. This weblog put up will stroll you thru a PowerShell script designed to fetch and report metrics from GitHub Copilot. The script automates the method of gathering knowledge, producing stories, and dealing with errors, making it simpler for directors to watch and analyze Copilot utilization.
Stipulations for this Answer:
Obtain the script from Git or PowerShell gallery from beneath hyperlinks:
Git:
https://github.com/VikasSukhija/Downloads
githubcopilotmetrics.ps1
PowerShell Gallery:
https://www.powershellgallery.com/packages/githubcopilotmetrics
Set up-Script -Title githubcopilotmetrics
Replace the beneath part of the script with your individual parameters:

Be aware: Assumption is you have got already created the token for producing github copilot metrics follwoing the earlier weblog put up – https://techwizard.cloud/2024/12/10/generate-github-copilot-usage-reports-with-api/
The Invoke-GitHubApi
operate contained in the script is liable for making API requests to GitHub and fetching the required knowledge. It handles pagination to make sure all outcomes are retrieved.
The script processes the fetched knowledge to generate person and utilization stories. It makes use of ForEach-Object
to iterate over the info and create customized objects for every document. The stories are then exported to CSV information. (It compares every object with Lively Listing to seek out the existence)
$Login = ($Login -replace ‘-‘, ‘.’ -replace ‘_’, ‘@’ -replace ‘testcb’, ‘check.com’)
Login info in github copilot will not be actual as person’s userprincipalname so above system is used to match the organizational tackle. In you case this is usually a completely different system.
Once you run the script beneath stories are generated and positioned in archive folder.
Languages and Solutions report are generated day clever in order to protect the info for longer interval.

API solely supplies knowledge for 30 days however utilizing this script to you keep knowledge as per your requirement after which present in energy BI report.
I hope this answer will help you in creating the gitub copilot metrics.
Thanks for studying and downloading…
Tech Wizard