CleanUp GitHub Actions
See original GitHub issueOur Github actions are a mess, we started and improved them over time, we renamed them etc. But now we do have some old Actions in there, which we do not need anymore. Sadly there is no GUI way of deleting them, but we can delete them via api.
We should delete all GitHub Actions which are deactivated:
within this GitHub support question answer, we do have all the script paths we need. The executor needs to have jq
and gh
installed.
- Fetching the workflow IDs with
OWNER=<your user/org name>
REPO=<repo name>
# list workflows
gh api -X GET /repos/$OWNER/$REPO/actions/workflows | jq '.workflows[] | .name,.id'
- Deleting all workflow runs with
OWNER=<your user/org name>
REPO=<repo name>
# copy the ID of the workflow you want to clear and set it
WORKFLOW_ID=<workflow id>
# list runs
gh api -X GET /repos/$OWNER/$REPO/actions/workflows/$WORKFLOW_ID/runs | jq '.workflow_runs[] | .id'
# delete all runs
gh api -X GET /repos/$OWNER/$REPO/actions/workflows/$WORKFLOW_ID/runs | jq '.workflow_runs[] | .id' | xargs -I{} gh api -X DELETE /repos/$OWNER/$REPO/actions/runs/{}
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Marketplace Actions Workflow run cleanup action - GitHub
This action cleans up previously running instances of a workflow on the same branch. This accomplishes the task of automatically cancelling CI runs...
Read more >How to actually clean up the repository on self-hosted runner ...
git folder, and then actions/checkout@v2 will clone the repository properly, just like when running on github runners. -H. Share.
Read more >Cleanup legacy GitHub Actions workflow runs. - Popular Blocks
Python utility to delete in bulk all GitHub Actions runs for a given workflow, either current or legacy/since removed. The GitHub UI currently...
Read more >GitHub Actions integration - Werf
... cleanup — the job to clean up the stages storage and the Docker registry. Jobs are based on comprehensive GitHub Actions, werf/actions,...
Read more >Github Action - Clean up resources - DEV Community
Github Action - Clean up resources · Check out git repo. · Build project. · Deploy to a Demo environment. · Clean up...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This comment made me think that, if #502 decides to pull in optional dependencies, modular builds should be part of the basic builds.
@aepfli I’ve cleaned out two of them manually but have capitulated for the third, which must have hundreds and hundreds of builds. Can you delete them automatically? 🥺