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.
Currently, GitHub does not provide built-in Retention policy for workflow runs.
As the workaround, you can try like as this:
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).
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.