Files
awesome-copilot/skills/copilot-usage-metrics/get-enterprise-metrics.sh
bbuna_microsoft 5de0d98cb8 Add copilot-usage-metrics skill
A Copilot CLI agent skill that retrieves and displays GitHub Copilot
usage metrics for organizations and enterprises via the REST API.

Features:
- Organization-level aggregated and per-user metrics
- Enterprise-level aggregated and per-user metrics
- Query metrics for specific dates
- Uses gh CLI for API authentication

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-17 14:59:25 +00:00

23 lines
678 B
Bash

#!/usr/bin/env bash
# Fetch aggregated Copilot usage metrics for an enterprise
# Usage: get-enterprise-metrics.sh <enterprise> [day]
# enterprise - GitHub enterprise slug
# day - (optional) specific day in YYYY-MM-DD format
set -euo pipefail
ENTERPRISE="${1:?Usage: get-enterprise-metrics.sh <enterprise> [day]}"
DAY="${2:-}"
if [ -n "$DAY" ]; then
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/enterprises/$ENTERPRISE/copilot/usage/day?day=$DAY"
else
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/enterprises/$ENTERPRISE/copilot/usage"
fi