Skip to content

CanarysPlayground/Individual-User-level-Budget-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Enterprise Budget Setup Script

This repository includes a Bash script that sets enterprise billing budgets for users using the GitHub CLI.

1. Create users.csv

Put one username per line:

emu_user1_ecanarys
emu_user2_ecanarys
emu_user3_ecanarys
emu_user4_ecanarys

2. Create the script locally

Save your script as:

set_budgets.sh

Make it executable:

chmod +x set_budgets.sh

3. Set required environment variables

export ENTERPRISE="your-enterprise-slug"
export API_VERSION="2022-11-28"

4. Authenticate with billing scope

gh auth refresh -h github.com -s manage_billing:enterprise

5. Set your budget amount in the script

Update the amount in set_budgets.sh before running:

BUDGET_AMOUNT=10.00

6. Run the script

./set_budgets.sh users.csv

Expected Output

[1] Processing user: emu_user1_ecanarys ... SUCCESS
[2] Processing user: emu_user2_ecanarys ... SUCCESS
[3] Processing user: emu_user3_ecanarys ... SKIPPED (already exists)

======================================
Total Processed: 3
Successful: 3
Failed: 0
======================================

CSV Format (users.csv)

emu_user1_ecanarys
emu_user2_ecanarys
emu_user3_ecanarys

Notes

  • The script skips empty lines and lines starting with #.
  • Ensure your GitHub account has enterprise billing permissions.
  • If you see "Not Found", verify the ENTERPRISE slug is correct.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages