Skip to content

Commit 0970648

Browse files
committed
Adding copilot check
1 parent 9782867 commit 0970648

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
. ./.gh-api-examples.conf
2+
3+
# https://docs.github.com/en/enterprise-cloud@latest/rest/copilot/copilot-usage-metrics?apiVersion=2022-11-28#get-copilot-enterprise-usage-metrics-for-a-specific-day
4+
# GET /enterprises/{enterprise}/copilot/metrics/reports/enterprise-1-day
5+
6+
7+
# If the script is passed an argument $1 use that as the day
8+
if [ -z "$1" ]
9+
then
10+
day=$(python3 -c "from datetime import date, timedelta; print((date.today() - timedelta(days=7)).isoformat())")
11+
else
12+
day=$1
13+
fi
14+
15+
16+
curl ${curl_custom_flags} \
17+
-H "X-GitHub-Api-Version: ${github_api_version}" \
18+
-H "Accept: application/vnd.github.v3+json" \
19+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
20+
"${GITHUB_API_BASE_URL}/enterprises/${enterprise}/copilot/metrics/reports/enterprise-1-day?day=${day}"

0 commit comments

Comments
 (0)