forkcleaner

package module
v2.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2023 License: MIT Imports: 7 Imported by: 0

README

fork-cleaner

Release Software License Build Status Go Report Card Godoc

Cleans up old and inactive forks on your GitHub account.

You'll need to create a personal access token with repo and delete_repo permissions.

Then, download the latest release and execute the binary as in:

./fork-cleaner --token "my github token" -u "my github username"

Fork-Cleaner will load your forked repositories ordered by the oldest first. This can take a little while as Fork-Cleaner will iterate over the page of forks and check the upstream repository status / any prs etc.

Fork-Cleaner will show you all your forks, you can then check which you want to delete or not on a TUI:

Screen Recording

Setting -skip-upstream=true will skip checking each repositories upstream (useful if you have a lot of forks to avoid hitting the rate-limit). This won't compare upstream commits, fetch upstream issues/prs, etc.

Install

homebrew:

brew install caarlos0/tap/fork-cleaner

snap:

snap install fork-cleaner

apt:

echo 'deb [trusted=yes] https://repo.caarlos0.dev/apt/ /' | sudo tee /etc/apt/sources.list.d/caarlos0.list
sudo apt update
sudo apt install fork-cleaner

yum:

echo '[caarlos0]
name=caarlos0
baseurl=https://repo.caarlos0.dev/yum/
enabled=1
gpgcheck=0' | sudo tee /etc/yum.repos.d/caarlos0.repo
sudo yum install fork-cleaner

deb/rpm/apk:

Download the .apk, .deb or .rpm from the releases page and install with the appropriate commands.

manually:

Download the pre-compiled binaries from the releases page or clone the repo build from source.

Troubleshooting

  • The loading takes a while - The app hits various endpoints in order to collect information on the upstream repository, this can take a while if you have a lot of forks.
  • I've hit the rate limit - You can check your current limits by calling the api like so:
curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/rate_limit

Stargazers over time

Stargazers over time

Documentation

Overview

Package forkcleaner provides functions to find and remove unused forks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(
	ctx context.Context,
	client *github.Client,
	deletions []*RepositoryWithDetails,
) error

Delete delete the given list of forks.

Types

type RepositoryWithDetails

type RepositoryWithDetails struct {
	Name               string
	ParentName         string
	RepoURL            string
	Private            bool
	ParentDeleted      bool
	ParentDMCATakeDown bool
	Forks              int
	Stars              int
	OpenPRs            int
	CommitsAhead       int
	LastUpdate         time.Time
}

func FindAllForks

func FindAllForks(ctx context.Context, client *github.Client, login string, skipUpstream bool) ([]*RepositoryWithDetails, error)

FindAllForks lists all the forks for the current user.

Directories

Path Synopsis
cmd
internal
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL