Skip to content

Paul1404/gh-batch-archive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gh-batch-archive

Batch archive or unarchive multiple GitHub repositories with maximum clarity, safety, and speed.

MIT License


Get started via a oneliner:

curl -sSL https://raw.githubusercontent.com/Paul1404/gh-batch-archive/main/gh-batch-archive.sh | bash

✨ Features

  • Batch archive or unarchive any number of repositories
  • Interactive selection (with fzf), or fallback to a simple menu
  • Pattern filtering to quickly narrow down your repo list
  • Dry-run mode for safe previews
  • Parallel processing for speed
  • Clear, explicit, and colorful messaging at every step
  • Action logging for auditability
  • No external dependencies except GitHub CLI (gh).
    (fzf is optional for best UX)

🚀 Quick Start

  1. Clone this repository:

    git clone https://github.com/Paul1404/gh-batch-archive.git
    cd gh-batch-archive
  2. Make the script executable:

    chmod +x gh-batch-archive.sh
  3. Authenticate with GitHub CLI (if you haven't already):

    gh auth login
  4. Run the script!

    ./gh-batch-archive.sh

🛠️ Usage

./gh-batch-archive.sh [options] [owner_or_org]

Options

Option Description
--unarchive Unarchive instead of archive
--dry-run Show what would be done, but don't change anything
--pattern Filter repos by substring or regex (e.g. --pattern "test")
--interactive Use interactive selection (fzf if available, fallback to menu)
--parallel N Process up to N repos in parallel (default: 4)
--log FILE Log actions to FILE (default: gh-batch-archive.log)
--help Show help message

Examples

  • Archive all your repositories:

    ./gh-batch-archive.sh
  • Archive all repositories for an organization:

    ./gh-batch-archive.sh myorg
  • Interactively select which repos to archive:

    ./gh-batch-archive.sh --interactive
  • Filter by pattern and archive:

    ./gh-batch-archive.sh --pattern "test"
  • Unarchive repositories (instead of archiving):

    ./gh-batch-archive.sh --unarchive
  • Preview what would happen (dry-run):

    ./gh-batch-archive.sh --dry-run
  • Process 8 repos in parallel:

    ./gh-batch-archive.sh --parallel 8

🖥️ Interactive Selection

If you have fzf installed, you can interactively select multiple repositories with your keyboard.
If not, the script will fall back to a simple numbered menu.


📋 Logging

All actions (including dry-runs) are logged to gh-batch-archive.log by default.
You can specify a different log file with --log myfile.log.


⚠️ Safety

  • Dry-run mode (--dry-run) lets you preview actions before making changes.
  • Explicit confirmation is required before any changes are made.
  • Clear summary of what will happen is shown before proceeding.

🧩 Requirements

  • GitHub CLI (gh) (required)
  • fzf (optional, for best interactive experience)
  • Bash 4.x or later

📝 License

MIT


🙋‍♂️ Contributing

Pull requests and suggestions are welcome!
Feel free to open an issue or submit a PR.


💡 Inspiration

This tool was built to make mass archiving and unarchiving of GitHub repositories safe, fast, and transparent for individuals and organizations.


About

Batch archive or unarchive multiple GitHub repositories with maximum clarity, safety, and speed.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages