Skip to content

jolonf-swift-components-test/aibot-script

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

GitHub Bulk Repository Manager

A zsh script for creating and deleting GitHub repositories in bulk. This is purely for testing creating GitHub repos from the command line.

Features

  • 🚀 Bulk Repository Creation: Create multiple GitHub repositories with a single command (with numbered indices)
  • 📥 Automatic Cloning: Optionally clone repositories to your local machine as they're created
  • 🧹 Bulk Cleanup: Delete multiple repositories with the same ease
  • 🏷️ Flexible Naming: Use custom prefixes for organized repository naming
  • 🏢 Organization Support: Works with both personal and organization repositories
  • Rate Limiting Protection: Built-in delays to respect GitHub API limits
  • 📊 Progress Tracking: Real-time feedback with success/failure indicators
  • 🛡️ Error Handling: Comprehensive error checking and reporting

Prerequisites

  1. GitHub CLI: Install the GitHub CLI tool

    # macOS
    brew install gh
    
    # Other platforms: https://cli.github.com/
  2. Authentication: Authenticate with GitHub

    gh auth login
  3. Delete Permissions (for cleanup): If you plan to use the --clean option

    gh auth refresh -h github.com -s delete_repo

Installation

  1. Clone or download the script:

    curl -O https://raw.githubusercontent.com/your-repo/gh-bulk-repo.zsh
  2. Make it executable:

    chmod +x gh-bulk-repo.zsh

Usage

./gh-bulk-repo.zsh [count] [prefix] [--clone] [--clean]

Parameters

  • count (optional): Number of repositories to create/delete (default: 1)
  • prefix (optional): Prefix for repository names (default: "test-repo")
  • --clone (optional): Clone repositories after creation
  • --clean (optional): Delete repositories instead of creating them

Repository Naming

Repositories are named using the pattern: {prefix}-{number}

Examples:

  • test-repo-1, test-repo-2, test-repo-3
  • my-project-1, my-project-2, my-project-3
  • org-name/batch-test-1, org-name/batch-test-2

Examples

Basic Usage

# Create 1 repository (default)
./gh-bulk-repo.zsh

# Create 10 repositories with default prefix
./gh-bulk-repo.zsh 10

# Create 5 repositories with custom prefix
./gh-bulk-repo.zsh 5 my-test-project

With Cloning

# Create 10 repositories and clone them locally
./gh-bulk-repo.zsh 10 development-test --clone

# Create 100 repositories with cloning
./gh-bulk-repo.zsh 100 batch-repos --clone

Organization Repositories

# Create repositories in an organization
./gh-bulk-repo.zsh 50 my-org/test-project --clone

# Clean up organization repositories
./gh-bulk-repo.zsh 50 my-org/test-project --clean

Cleanup Operations

# Delete 10 repositories with matching prefix
./gh-bulk-repo.zsh 10 test-repo --clean

# Clean up a large batch
./gh-bulk-repo.zsh 1000 load-test --clean

Flexible Flag Usage

Flags can be placed anywhere in the command:

./gh-bulk-repo.zsh --clone 10 test-repo
./gh-bulk-repo.zsh 10 --clean test-repo
./gh-bulk-repo.zsh --clean 10 test-repo

Output Example

Creation Mode

🚀 Starting GitHub repository creation...
📊 Count: 10
🏷️  Prefix: test-repo
📥 Clone repos: true
⏱️  Started at: Fri Jun 13 13:25:43 AEST 2025

Creating repository: test-repo-1 ... ✅ SUCCESS
Creating repository: test-repo-2 ... ✅ SUCCESS
Creating repository: test-repo-3 ... ✅ SUCCESS
...

🎉 Repository creation completed!
📈 Summary:
   ✅ Successful: 10
   ❌ Failed: 0
   📊 Total attempted: 10

Cleanup Mode

🧹 Starting GitHub repository cleanup...
📊 Count: 10
🏷️  Prefix: test-repo
⏱️  Started at: Fri Jun 13 13:30:15 AEST 2025

Deleting repository: test-repo-1 ... ✅ DELETED
Deleting repository: test-repo-2 ... ✅ DELETED
...

🎉 Repository cleanup completed!
📈 Summary:
   ✅ Deleted: 10
   ❌ Failed: 0
   📊 Total attempted: 10

Error Handling

The script includes comprehensive error handling:

  • Invalid arguments: Clear error messages for incorrect usage
  • Authentication issues: Checks for GitHub CLI authentication
  • Permission errors: Validates required scopes for deletion
  • API failures: Tracks and reports failed operations
  • Rate limiting: Built-in delays to prevent API rate limit issues

Use Cases

Development & Testing

  • Create multiple test repositories for CI/CD testing
  • Set up development environments with consistent naming
  • Test GitHub integrations at scale

Educational & Training

  • Create repositories for workshop participants
  • Set up classroom environments
  • Demonstrate Git workflows with multiple repos

Batch Operations

  • Migrate or reorganize repository structures
  • Create template repositories in bulk
  • Clean up after large-scale testing

Safety Features

  • Confirmation prompts: GitHub CLI handles confirmation for destructive operations
  • Scope validation: Checks for required permissions before attempting operations
  • Error isolation: Failed operations don't stop the entire batch
  • Detailed reporting: Clear summary of successful and failed operations

Limitations

  • Rate limits: GitHub API has rate limits; the script includes delays but very large batches may still hit limits
  • Repository limits: GitHub accounts have repository limits depending on plan type
  • Network dependency: Requires stable internet connection for API calls

Contributing

Feel free to submit issues, feature requests, or pull requests to improve this tool.

License

This script is provided as-is for educational and utility purposes.

About

Script to test generating 1000 GitHub repos

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages