How to remove stale github workflows

There’s a long standing Github ticket for removing stale github workflows. Turns out there’s no way to remove a workflow.

The work around here is to remove all workflow runs first.

  1. Install github command line tool: brew install gh
  2. In the repo’s working directory do the following:
1
gh run list --workflow=stale-workflow.yml --json databaseId | jq '.[].databaseId' | xargs -I{} gh run delete {}

Replace stale-workflow.yml with the appropriate workflow file name.

Note that this does not handle the case where there are many hundreds of workflow runs.

comments powered by Disqus