Feature: Delete *all* old workflow runs

I have currently over 300 workflow runs cluttering my github actions. Mainly old workflows that are not used anymore for months. Is there any way to delete them all together? I could only find a one by one delete option.

@valentijnscholten ,

Currently, GitHub does not provide built-in Retention policy for workflow runs.

As the workaround, you can try like as this:

  1. Set up a workflow runs on schedule event and/or workflow_dispatch event.

  2. Set up a step in the workflow to execute the “List workflow runs for a repository” API. This API will return the details of all the workflow runs in the repository. From the retuned details, you can get the time when each run was triggered ( created_at).

  3. Calculate the time interval between the created_at of each run and current time. If the interval between reaches 1 month (30 days), use the “Delete a workflow run” API to delete the run.

Of course, if you really need the feature that GitHub provides built-in Retention policy for workflow runs, I recommend that you can directly report a feature request here. That will allow you to directly interact with the appropriate engineering team, and make it more convenient for the engineering team to collect and categorize your suggestions.