DEV Community

Cover image for GitHub Actions Has a Cleanup Problem — So I Built a Tool
Aakash Choudhary
Aakash Choudhary

Posted on

GitHub Actions Has a Cleanup Problem — So I Built a Tool

gh-prune 🧹

           __                                                                 
          /  |                                                                
  ______  $$ |____            ______    ______   __    __  _______    ______  
 /      \ $$      \  ______  /      \  /      \ /  |  /  |/       \  /      \ 
/$$$$$$  |$$$$$$$  |/      |/$$$$$$  |/$$$$$$  |$$ |  $$ |$$$$$$$  |/$$$$$$  |
$$ |  $$ |$$ |  $$ |$$$$$$/ $$ |  $$ |$$ |  $$/ $$ |  $$ |$$ |  $$ |$$    $$ |
$$ \__$$ |$$ |  $$ |        $$ |__$$ |$$ |      $$ \__$$ |$$ |  $$ |$$$$$$$$/ 
$$    $$ |$$ |  $$ |        $$    $$/ $$ |      $$    $$/ $$ |  $$ |$$       |
 $$$$$$$ |$$/   $$/         $$$$$$$/  $$/        $$$$$$/  $$/   $$/  $$$$$$$/ 
/  \__$$ |                  $$ |                                              
$$    $$/                   $$ |                                              
 $$$$$$/                    $$/                                               
Enter fullscreen mode Exit fullscreen mode

Keep your GitHub Actions clean. No more ghost workflows.

The Problem

If you use GitHub Actions regularly, you’ve probably noticed something odd:

  1. You delete a workflow file (.github/workflows/old-flow.yml).
  2. But the workflow still appears in the Actions tab.

Then comes the painful part:

  • Clicking through runs one by one.
  • Manually deleting history.
  • Realizing there’s no native bulk cleanup button.

As a DevOps engineer, this felt like unnecessary friction.

gh-prune solves this.


What is gh-prune?

gh-prune is a Python-based CLI tool built on top of the GitHub CLI. It is designed to inspect your repository, identify workflow runs, and help you bulk-delete old or unwanted history to properly clean up the Actions UI.

Key Features

  • 🔍 Inspect GitHub Actions workflows.
  • 📋 List workflow runs clearly.
  • 🗑️ Bulk Delete old or unwanted runs.
  • Clean the Actions UI of "deleted" workflows that persist in history.

Prerequisites

Because gh-prune leverages the official GitHub CLI for authentication and API interaction, you must have it installed and authenticated.

  1. Install GitHub CLI: Installation Guide
  2. Authenticate:

    gh auth login
    

Installation

gh-prune is available on PyPI. You can install it via pip:

pip install gh-prune
Enter fullscreen mode Exit fullscreen mode

Top comments (0)