Skip to content

shadow-robot/copilot-slack-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Copilot Usage Slack Bot

Posts daily GitHub Copilot per-user usage metrics to a Slack channel via a scheduled GitHub Actions workflow.

What it reports

For each user with activity on the previous day:

  • Interaction count (prompts sent to Copilot)
  • Code generations and acceptances
  • Lines of code added
  • Activity type (chat, agent, CLI, completions)
  • Aggregate model usage breakdown
  • CLI token consumption (if applicable)

Setup

1. Create a GitHub Personal Access Token

Create a fine-grained PAT scoped to the shadow-robot organization with:

  • "Organization Copilot metrics" permission: Read

Alternatively, a classic PAT with read:org scope works.

2. Create a Slack Incoming Webhook

  1. Go to https://api.slack.com/apps and create a new app (or use an existing one)
  2. Enable Incoming Webhooks
  3. Add a webhook to the channel where you want reports posted
  4. Copy the webhook URL

3. Add repository secrets

In the GitHub repo hosting this code, go to Settings → Secrets and variables → Actions and add:

Secret Value
COPILOT_METRICS_TOKEN Your GitHub PAT from step 1
SLACK_WEBHOOK_URL Your Slack webhook URL from step 2

4. Enable the Copilot usage metrics policy

In your org settings, ensure Copilot Usage Metrics API is enabled:

  • Go to your org → Settings → Copilot → Policies
  • Enable "Copilot usage metrics"

5. Push and go

Push this repo to GitHub. The workflow runs daily at 08:00 UTC. You can also trigger it manually from the Actions tab (with an optional day override).

Local testing

export GH_TOKEN="ghp_..."
export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..."
export GITHUB_ORG="shadow-robot"
# export REPORT_DAY="2026-05-05"  # optional override

pip install -r requirements.txt
python copilot_usage.py

Important notes

  • The API requires the "Copilot usage metrics" policy to be enabled at the org level
  • Data is available starting from the day after the policy is enabled
  • Reports for a given day are processed overnight; yesterday's data is typically available by morning
  • Only org owners (admins) can access these metrics via the API

About

Code to push copilot metrics to slack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages