Skip to content

Commit 62f836a

Browse files
committed
Update copilot-usage-report workflow: correct repository reference and enhance API documentation
1 parent 7d88a17 commit 62f836a

1 file changed

Lines changed: 202 additions & 10 deletions

File tree

.github/workflows/copilot-usage-report.yml

Lines changed: 202 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- Organization: ${{ github.event.inputs.organization || github.event.organization.login }}
3333

34-
- Repository (For issue creation): ${{ github.event.repository.name }}
34+
- Repository (For issue creation): ${{ github.repository }}
3535

3636
---
3737

@@ -41,17 +41,209 @@ jobs:
4141

4242
### Step 1: Data Collection
4343

44-
Gather data from these GitHub API endpoints:
44+
Gather data from these GitHub REST API endpoints:
45+
46+
---
47+
48+
#### 📊 Copilot Metrics API
49+
50+
**Get Copilot metrics for an organization**
51+
```
52+
GET /orgs/{org}/copilot/metrics
53+
```
54+
55+
| Parameter | Type | Description |
56+
|-----------|------|-------------|
57+
| `org` | string | **Required.** The organization name (case insensitive) |
58+
| `since` | string | Show metrics since this date (ISO 8601: `YYYY-MM-DDTHH:MM:SSZ`). Max 100 days ago |
59+
| `until` | string | Show metrics until this date (ISO 8601). Should not precede `since` |
60+
| `page` | integer | Page number for pagination. Default: `1` |
61+
| `per_page` | integer | Results per page (max 100). Default: `100` |
62+
63+
**Required Scopes:** `manage_billing:copilot`, `read:org`, or `read:enterprise`
64+
65+
**Returns:** Aggregated metrics including:
66+
- `total_active_users`, `total_engaged_users`
67+
- `copilot_ide_code_completions` (languages, editors, models, suggestions, acceptances, lines)
68+
- `copilot_ide_chat` (chats, insertion events, copy events)
69+
- `copilot_dotcom_chat` and `copilot_dotcom_pull_requests`
70+
71+
---
72+
73+
**Get Copilot metrics for a team**
74+
```
75+
GET /orgs/{org}/team/{team_slug}/copilot/metrics
76+
```
77+
78+
| Parameter | Type | Description |
79+
|-----------|------|-------------|
80+
| `org` | string | **Required.** The organization name |
81+
| `team_slug` | string | **Required.** The slug of the team name |
82+
| `since` | string | Show metrics since this date (ISO 8601) |
83+
| `until` | string | Show metrics until this date (ISO 8601) |
84+
| `page` | integer | Page number. Default: `1` |
85+
| `per_page` | integer | Results per page (max 100). Default: `100` |
86+
87+
> **Note:** Only returns results for days when the team had 5+ members with active Copilot licenses.
88+
89+
---
90+
91+
**Get Copilot metrics for an enterprise**
92+
```
93+
GET /enterprises/{enterprise}/copilot/metrics
94+
```
95+
96+
| Parameter | Type | Description |
97+
|-----------|------|-------------|
98+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
99+
| `since` | string | Show metrics since this date (ISO 8601). Max 100 days ago |
100+
| `until` | string | Show metrics until this date (ISO 8601) |
101+
| `page` | integer | Page number. Default: `1` |
102+
| `per_page` | integer | Days of metrics per page (max 100). Default: `100` |
103+
104+
**Required Scopes:** `manage_billing:copilot` or `read:enterprise`
105+
106+
---
107+
108+
#### 📈 Copilot Usage Metrics API (Enterprise)
109+
110+
**Get Copilot enterprise usage metrics (28-day rolling)**
111+
```
112+
GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-28-day/latest
113+
```
114+
115+
| Parameter | Type | Description |
116+
|-----------|------|-------------|
117+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
118+
119+
**Returns:** Download links to comprehensive 28-day usage report files with `report_start_day` and `report_end_day`.
120+
121+
---
122+
123+
**Get Copilot enterprise usage metrics for a specific day**
124+
```
125+
GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day?day={day}
126+
```
127+
128+
| Parameter | Type | Description |
129+
|-----------|------|-------------|
130+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
131+
| `day` | string | **Required.** The day to request data for (`YYYY-MM-DD` format) |
132+
133+
**Returns:** Download links to daily usage report with `report_day`.
134+
135+
---
136+
137+
**Get Copilot users usage metrics (28-day rolling)**
138+
```
139+
GET /enterprises/{enterprise}/copilot/metrics/reports/users-28-day/latest
140+
```
141+
142+
| Parameter | Type | Description |
143+
|-----------|------|-------------|
144+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
145+
146+
**Returns:** User-level usage data and engagement metrics for the previous 28 days.
147+
148+
---
149+
150+
**Get Copilot users usage metrics for a specific day**
151+
```
152+
GET /enterprises/{enterprise}/copilot/metrics/reports/users-1-day?day={day}
153+
```
154+
155+
| Parameter | Type | Description |
156+
|-----------|------|-------------|
157+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
158+
| `day` | string | **Required.** The day to request data for (`YYYY-MM-DD` format) |
159+
160+
---
161+
162+
#### 💺 Copilot User Management API (Seat Assignments)
163+
164+
**Get Copilot seat information and settings for an organization**
165+
```
166+
GET /orgs/{org}/copilot/billing
167+
```
168+
169+
| Parameter | Type | Description |
170+
|-----------|------|-------------|
171+
| `org` | string | **Required.** The organization name (case insensitive) |
45172

46-
1. **Metrics Endpoint**: `GET /orgs/${{ github.event.organization.login }}/copilot/metrics`
47-
- Collect usage statistics, acceptance rates, language breakdowns
48-
- User engagement metrics
49-
- Editor and IDE usage patterns
173+
**Required Scopes:** `manage_billing:copilot` or `read:org`
50174

51-
2. **Billing Endpoint**: `GET /orgs/${{ github.event.organization.login }}/copilot/billing`
52-
- Seat assignments and total seats
53-
- Active users vs. total seats
54-
- Billing breakdown and costs
175+
**Returns:**
176+
- `seat_breakdown`: `total`, `added_this_cycle`, `pending_invitation`, `pending_cancellation`, `active_this_cycle`, `inactive_this_cycle`
177+
- `seat_management_setting`, `ide_chat`, `platform_chat`, `cli`, `public_code_suggestions`, `plan_type`
178+
179+
---
180+
181+
**List all Copilot seat assignments for an organization**
182+
```
183+
GET /orgs/{org}/copilot/billing/seats
184+
```
185+
186+
| Parameter | Type | Description |
187+
|-----------|------|-------------|
188+
| `org` | string | **Required.** The organization name (case insensitive) |
189+
| `page` | integer | Page number. Default: `1` |
190+
| `per_page` | integer | Results per page (max 100). Default: `50` |
191+
192+
**Required Scopes:** `manage_billing:copilot` or `read:org`
193+
194+
**Returns:**
195+
- `total_seats`: Total number of Copilot seats
196+
- `seats`: Array of seat objects with:
197+
- `created_at`, `updated_at`, `pending_cancellation_date`
198+
- `last_activity_at`, `last_activity_editor`, `last_authenticated_at`
199+
- `plan_type`, `assignee` (user details), `assigning_team`
200+
201+
---
202+
203+
**Get Copilot seat assignment details for a user**
204+
```
205+
GET /orgs/{org}/members/{username}/copilot
206+
```
207+
208+
| Parameter | Type | Description |
209+
|-----------|------|-------------|
210+
| `org` | string | **Required.** The organization name |
211+
| `username` | string | **Required.** The GitHub username |
212+
213+
**Required Scopes:** `manage_billing:copilot` or `read:org`
214+
215+
---
216+
217+
**List all Copilot seat assignments for an enterprise**
218+
```
219+
GET /enterprises/{enterprise}/copilot/billing/seats
220+
```
221+
222+
| Parameter | Type | Description |
223+
|-----------|------|-------------|
224+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
225+
| `page` | integer | Page number. Default: `1` |
226+
| `per_page` | integer | Results per page (max 100). Default: `50` |
227+
228+
**Required Scopes:** `manage_billing:copilot` or `read:enterprise`
229+
230+
> **Note:** Users with access through multiple orgs/teams will only be counted once toward `total_seats`.
231+
232+
---
233+
234+
**Get Copilot seat assignment details for an enterprise user**
235+
```
236+
GET /enterprises/{enterprise}/members/{username}/copilot
237+
```
238+
239+
| Parameter | Type | Description |
240+
|-----------|------|-------------|
241+
| `enterprise` | string | **Required.** The slug version of the enterprise name |
242+
| `username` | string | **Required.** The GitHub username |
243+
244+
**Required Scopes:** `manage_billing:copilot` or `read:org`
245+
246+
---
55247

56248
### Step 2: Data Analysis
57249

0 commit comments

Comments
 (0)