Skip to content

Feature/copilot report ai credit budgets - #53

Merged
locus313 merged 2 commits into
mainfrom
feature/copilot-report-ai-credit-budgets
Aug 4, 2026
Merged

Feature/copilot report ai credit budgets#53
locus313 merged 2 commits into
mainfrom
feature/copilot-report-ai-credit-budgets

Conversation

@locus313

@locus313 locus313 commented Aug 4, 2026

Copy link
Copy Markdown
Owner

This pull request adds support for reporting and optionally skipping per-user AI credit budgets (Universal and Individual) in the GitHub Copilot enterprise usage report. The script now fetches and displays each user's effective AI credit budget and their consumption, and introduces a --no-budgets option to disable this lookup if desired. Documentation, the GitHub Action, and tests have been updated accordingly.

Major feature: Per-user AI credit budgets

  • The script now fetches enterprise-level AI credit budgets (Universal and Individual overrides) and records each user's effective budget and usage, displaying this in the CSV output. [1] [2] [3]
  • Adds a --no-budgets option to skip budget lookups, with appropriate handling and messaging if the user lacks permissions or budgets are not configured. [1] [2] [3] [4] [5] [6] [7]

Documentation updates

  • The README.md and script comments are updated to describe the new budget reporting features and the new --no-budgets option, including requirements and expected output. [1] [2] [3] [4]

Output changes

  • The CSV report now includes new columns: Budget Scope, Budget Limit (USD), Budget Used (USD), and Budget Remaining (USD) for each user.

Test coverage

  • Adds a test to ensure the --no-budgets option is recognized and handled by the script.## Description

Changes

  • New script: <domain>/github-<name>/github-<name>.sh
  • Modified: lib/github-common.sh
  • Other:

How to test

export GITHUB_TOKEN=ghp_REDACTED
export ORG=test-org
./path/to/script.sh [--dry-run]

Checklist

  • set -euo pipefail is the first executable line after the # === header
  • Script sources lib/github-common.sh via SCRIPT_DIR
  • All required env vars validated with require_env_var
  • Token validated with validate_github_token (or validate_token for secondary tokens)
  • User-supplied slugs validated with validate_slug
  • sleep added between repo-level operations to respect rate limits
  • README.md updated with the new/changed script (env var table + usage example)
  • Script header comment matches README documentation
  • Tested on a non-production org before production
  • shellcheck passes (shellcheck --severity=warning --exclude=SC2034,SC1091 --shell=bash <script>)

Patrick Lewis added 2 commits August 4, 2026 08:48
Reports each licensed user's effective Universal/Individual AI credit
budget and consumption via the enterprise-level Budgets API
(GET /enterprises/{enterprise}/settings/billing/budgets and
.../budgets/{id}/user-states), adding Budget Scope/Limit/Used/Remaining
CSV columns. Adds a --no-budgets flag to skip the lookup.
@locus313
locus313 merged commit c4eddb4 into main Aug 4, 2026
2 checks passed
@locus313
locus313 deleted the feature/copilot-report-ai-credit-budgets branch August 4, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant