A tool to identify and archive inactive GitHub repositories based on a configurable inactivity threshold.
GitHub Archiver automates the process of analyzing repositories for inactivity and archiving them. It:
- Lists all repositories for a specified user or organization
- Analyzes repository activity to identify inactive ones
- Archives inactive repositories by:
- Creating an archive namespace (if needed)
- Forking to the archive namespace
- Deleting the original repository
- Marking the forked repository as archived
go get github.com/eyedeekay/github-archiver- Go 1.x
- github.com/google/go-github/v59
- golang.org/x/oauth2
github-archiver --token YOUR_GITHUB_TOKEN --target USERNAME [options]--token: GitHub personal access token (required)--target: GitHub username or organization (required)--dry-run: Analyze repositories without making changes--org: Specify if target is an organization (default: false)--threshold: Inactivity threshold in years (default: 2)--verbose: Enable verbose (debug) logging--quiet: Show only warnings and errors
To identify repositories inactive for 3+ years and perform archiving:
github-archiver --token ghp_xxxxxxxxxxxx --target myusername --threshold 3For a dry run that only reports inactive repositories:
github-archiver --token ghp_xxxxxxxxxxxx --target myorg --org --dry-runFor detailed debug information:
github-archiver --token ghp_xxxxxxxxxxxx --target myusername --verbose- Client: Wraps GitHub API functionality
- Analyzer: Identifies inactive repositories based on the inactivity threshold
- Archiver: Handles the repository archiving process
- Logger: Provides structured logging with multiple severity levels
The archive namespace requires manual creation for now.
Create it as {target}-archive (e.g., username-archive).