This tool allows you to delete GitHub workflow runs older than a specified number of days from a repository.
Before using this tool, ensure you have the following:
- Python 3.x installed on your system.
- A GitHub Personal Access Token with sufficient permissions. You can create one here. Make sure it has the
repo
scope.
To use the tool, follow these steps:
-
Clone this repository or download the script directly.
-
Navigate to the directory containing the script.
-
Install required packages using requirements.txt in this repository:
pip install -r requirements.txt
-
Run the script using the following command:
python delete_workflow_runs.py <repo_owner> <repo_name> -t <github_token> [-d <retention_days>]
- Replace
<repo_owner>
and<repo_name>
with the owner and name of the repository from which you want to delete workflow runs. - Replace
<github_token>
with your GitHub Personal Access Token. - Optionally, you can specify the retention period in days using the
-d
or--retention_days
argument. By default, it's set to 30 days.
- Replace
-
Follow the prompts to confirm the deletion of workflow runs.
Here's an example command to delete workflow runs older than 30 days from a repository:
python delete_workflow_runs.py myusername myrepository -t YOUR_GITHUB_TOKEN -d 30
Use this tool at your own risk. The author is not responsible for any data loss or damage caused by the misuse of this tool.