How to bulk delete offline Gitea runners?
Created: Jul 31, 2025
I recently switched to Gitea as my main Git instance
for my personal stuff. And because I am who I am, I didn't want to take anything
off the rack and decided to self-host a Gitea instance in my homelab. Said and
done, but i somehow forgot to persist the /data
directory for my Gitea Act
Runner containers. This directory is crucial as it contains the .runner
file,
which stores the runner token.
The consequence? Every time a Gitea Act Runner container restarted, a new runner was registered with my Gitea instance and I ended up with 590 offline runners visible in the Gitea Web UI (accessible at https://your-gitea-instance/-/admin/actions/runners).
As I don't like loose ends i definitely had to clean this up but unfortunately the Web UI lacks a "Delete all offline runners" button. Luckily Gitea provides an API endpoint to delete single runners:
Deleting offline runners via API
You can use a simple curl
command within a loop to delete the runners. You'll
need an API token with administrative privileges for your Gitea instance.
First, set your Gitea API token as an environment variable:
TOKEN="YOUR_GITEA_API_TOKEN"
Option 1: Using a for
loop
for (( i=590; i>=0; i-- )); do
curl -X DELETE \
"https://your-gitea-instance/api/v1/admin/actions/runners/${i}?token=${TOKEN}"
done
Option 2: Using seq
seq 590 -1 0 | while read i; do
curl -X DELETE \
"https://your-gitea-instance/api/v1/admin/actions/runners/${i}?token=${TOKEN}"
done
After that everything was neat and tidy again: