A powerful command-line tool for batch managing GitHub organization operations including user invitations, team management, and repository creation.
- 🎯 Batch User Invitations — Invite multiple users from a CSV file
- 👥 Team Management — Automatically add invited users to teams
- 📦 Repository Creation — Create repositories for organizations and personal accounts
- 🏷️ Release Tag Validation — Fetch latest release tags and verify allowed assets
- 🔐 Token Management — Generate GitHub tokens with Device Flow authentication
- 💾 Smart .env Management — Automatically save/update tokens in
.envfiles - 🚀 Dry Run Mode — Preview changes before executing
- ⚡ Rate Limit Handling — Automatic rate limit detection and sleep/retry logic
- 📊 Detailed Logging — Clear, color-coded output with progress indicators and warnings
- Python 3.9+
- GitHub organization admin access (for org actions)
- GitHub Personal Access Token with scopes:
admin:org— Manage organization invitationsread:user— Read user profile datarepo— Create repositories and read tags/releases
git clone https://github.com/yourusername/github-tool.git
cd github-tool
poetry install
poetry shell
github-tool --helpgit clone https://github.com/yourusername/github-tool.git
cd github-tool
pip install -r requirements.txt
pip install -e .[tool.poetry.dependencies]
python = "^3.9"
requests = "^2.31.0"
typer = {extras = ["all"], version = "^0.9.0"}
python-dotenv = "^1.0.0"
loguru = "^0.7.0"Create a .env file:
GITHUB_ORG=my-org
GITHUB_TOKEN=ghp_your_token_heregithub-tool invite --csv users.csv --org myorg
github-tool invite --csv users.csv --org myorg --team devs
github-tool invite --csv users.csv --org myorg --dry-runCSV Example
username
alice
bob@example.com
charlie
You can now create repositories for both organizations and personal accounts directly from the CLI.
github-tool repos --csv repos.csv --org myorgIf you omit --org, repositories are created under your personal GitHub account.
github-tool repos --csv repos.csv# Create public repositories
github-tool repos --csv repos.csv --org myorg --public
# Initialize with README
github-tool repos --csv repos.csv --org myorg --auto-init
# Add templates
github-tool repos --csv repos.csv --org myorg --gitignore Python --license mit
# Test configuration (no changes)
github-tool repos --csv repos.csv --org myorg --dry-runExample repos.csv
name,description,private,auto_init,gitignore_template,license_template
core-api,Main API,true,true,Python,mit
frontend-app,Web UI,false,true,Node,apache-2.0
--org→ creates under that organization.- No
--org→ creates under authenticated user’s personal account. - The client uses
.envGITHUB_ORGif no flag is passed. - Logs creation URLs and handles “already exists” automatically.
- Returns success (
0) or error exit codes for CI/CD pipelines.
from core.github_client import GitHubClient
client = GitHubClient("ghp_token")
latest_tag = client.fetch_tags("myorg/my-repo", disallowed_exts=[".exe", ".bat"])
print(latest_tag)github-tool token --savegithub-tool/
├── cli/
│ └── app.py
├── core/
│ ├── github_client.py
│ ├── csv_processor.py
│ └── token_manager.py
└── tests/
from core.github_client import GitHubClient, RepositoryConfig
client = GitHubClient("ghp_token")
# Invite user
client.invite_user("myorg", "alice")
# Add to team
client.add_to_team("myorg", "devs", "alice")
# Create repository (org or user)
repo_cfg = RepositoryConfig(
name="new-repo",
description="Automation test",
private=True,
auto_init=True,
gitignore_template="Python",
license_template="mit"
)
client.create_repository("myorg", repo_cfg) # Organization repo
client.create_repository(None, repo_cfg) # Personal repoRate Limits: Automatically handled with retry logic.
Auth Errors: Ensure correct token scopes (admin:org,repo,read:user).
CSV Errors: Ensure UTF-8 encoding and correct headers.
Fork, branch, commit, and open a pull request.
MIT License