Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Fork Purger

>> Delete all of your forked repositories on Github <<

python github_actions


  • Install using pip:

    pip install fork-purger


  • Create and collect your Github user access token.

  • Inspect the --help menu. Run:

    fork-purger --help

    This will print the following:

    +-+-+-+-+ +-+-+-+-+-+-+
    |F|o|r|k| |P|u|r|g|e|r|
    +-+-+-+-+ +-+-+-+-+-+-+
    Usage: fork-purger [OPTIONS]
    --username TEXT       Your Github username.  [required]
    --token TEXT          Your Github access token with delete permission.
    --debug / --no-debug  See full traceback in case of HTTP error.
    --delete              Delete the forked repos.
    --help                Show this message and exit.
  • By default, fork-purger runs in dry mode and doesn't do anything other than just listing the repositories that are about to be deleted. Run:

    fork-purger --username <gh-username> --token <gh-access-token>

    You'll see the following output:

    +-+-+-+-+ +-+-+-+-+-+-+
    |F|o|r|k| |P|u|r|g|e|r|
    +-+-+-+-+ +-+-+-+-+-+-+
    These forks will be deleted:
  • To delete the listed repositories, run the CLI with the --delete flag:

    fork-purger --username <gh-username> --token <gh-access-token> --delete

    The output should look similar to this:

    +-+-+-+-+ +-+-+-+-+-+-+
    |F|o|r|k| |P|u|r|g|e|r|
    +-+-+-+-+ +-+-+-+-+-+-+
    Deleting forked repos:
  • In case of exceptions, if you need more information, you can run the CLI with the --debug flag. This will print out the Python stack trace on the stdout.

    fork-purger --username <gh-username> --token <gh-access-token> --delete --debug


Internally, fork-purger leverages Python's coroutine objects to collect the URLs of the forked repositories from GitHub and delete them asynchronously. Asyncio coordinates this workflow in a producer-consumer orientation which is choreographed in the orchestrator function. The following diagram can be helpful to understand how the entire workflow operates:


Here, the square boxes are async functions and each one of them is dedicated to carrying out a single task.

In the first step, an async function calls a GitHub GET API to collect the URLs of the forked repositories. The enqueue function then aggregates those URLs and puts them in a queue. The dequeue function pops the URLs from the queue and sends them to multiple worker functions to achieve concurrency. Finally, the worker functions leverage a DELETE API to purge the forked repositories.