Skip to content

AdityaLF/Delete-GH-Workflow-Runs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Delete GitHub Workflow Runs

A simple Python script to delete all GitHub Actions workflow runs from a repository using the GitHub API. Ideal for cleaning up old workflows, especially for repositories with frequent deploys.

Note: Is not committed to GitHub or stored in public files.


πŸ”§ Features

  • Fetches workflow runs from GitHub Actions API.
  • Deletes all workflow runs in batches (100 per page).
  • Logs success and failure status for each run deletion.
  • Easy to configure with your GitHub username, repository, and token.

πŸ“¦ Requirements

  • Python 3.6+
  • requests module (Install using: pip install requests)

πŸš€ Usage

  1. Clone this repository

    git clone https://github.com/AdityaLF/Delete-GH-Workflow-Runs.git
    cd Delete-GH-Workflow-Runs
  2. Generate your GitHub Personal Access Token (PAT):

    • Go to GitHub Token Settings.

    • Click on "Generate new token".

    • Provide a name for the token ("delworkflows-script").

    • Select the required scopes:

      • repo: needed for repository actions.

      • workflow: needed to delete workflows.

    • Click Generate token.

    • Copy the token (you won’t be able to see it again, so store it securely).

  3. Edit the configuration section at the top of the script:

    owner = 'your-username'         # Replace with your GitHub username
    repo = 'your-repository'        # Replace with your GitHub repository name
    token = 'your-github-token'     # Replace with your GitHub Personal Access Token (PAT)
  4. Run the script:

    python delworkflows.py

πŸ‘€ Author


πŸ“„ License

This project is licensed under the MIT License.

About

Quickly remove all workflow runs from any GitHub repository.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages