Remove workflows older than xxx #26044
-
Hi, my old github action workflows (more than 600 atm) are still referencing commits that are not referenced by any branch and should normally be unreachable and thus deleted. Maybe the workflow implementation is using underlying branches. Your ways of managing data storage is none of my business but it actually causes me some pain since the jira integration shows all the commits containing reference to the ticket … even from unreachable commits that have triggered workflows, have been changed and are no longer relevant. So, as many of us have done before me, I’m begging you to implement an API to remove old executed workflows so we can clean them up like developers do : not manually ! By advance, I thank you for this and for the action workflows that otherwise is perfect for my usage ! Pierre |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You can find the documentation for the API to delete a workflow run on the GitHub Docs https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run. |
Beta Was this translation helpful? Give feedback.
-
Hi @pierre-gautier, You can complete this with two apis: Get all the workflow runs for your repository with this API, add parameters to filter:
parse the workflow run id which timestamp is older than XXX(eg: use jq command). Create a loop, use the workflow run ids for deletion workflow runs API: Thanks |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot ! I did some researches before posting but all I could find was this blog entry and did not think to check for the API doc, my bad. Since others could follow the same path, maybe adding something in this blog entry would be a good idea. Last but not least, it seems to me that most of github actions users will need an action like purge artifacts to clean runs one day or another. Something even better integrated like configuration would be even greater. Have a good day |
Beta Was this translation helpful? Give feedback.
You can find the documentation for the API to delete a workflow run on the GitHub Docs https://docs.github.com/en/rest/reference/actions#delete-a-workflow-run.