Python utility to delete in bulk all GitHub Actions runs for a given workflow, either current or legacy/since removed. The GitHub UI currently allows removal of individual workflow runs, but this becomes tedious with a bulk of previous runs.
Create a Personal access token with workflow
scope:
Execute the script against a target GitHub repository and workflow ID:
export AUTH_TOKEN="GITHUB_PERSONAL_ACCESS_TOKEN"
./remove --repository-name OWNER_NAME/REPOSITORY_NAME --workflow-id WORKFLOW_ID
where:
OWNER_NAME
is either a GitHub username or organisation name.WORKFLOW_ID
is the YAML filename that defined the workflow.
example:
export AUTH_TOKEN="GITHUB_PERSONAL_ACCESS_TOKEN"
./remove --repository-name magnetikonline/my-test-repo --workflow-id test.yaml
Once executed, script will retreive the IDs of each run associated to the given workflow ID and then delete each one in turn.