Deleting old CI/CD Actions for Azure in GitHub

There is no delete in team

Published on Tuesday, 27 December 2022

I had to redo my azure CI/CD action because M$ removed my old static web site (cleaning out old MSDN licensed resources). I now had two actions in my repository and only one worked. There does not seem to be any delete function in the github interface for actions.

This is how I deleted the old action.

  1. disable the bad actor
  2. install snap gh on linux
  3. gh auth
  4. run the following powershell script
  5. delete the yml file for the old action in .github/workflows
    $repo = "myrepo.isnowhere.org"
    $org = "myGitUser"

    $workflow_ids=($(gh api repos/$org/$repo/actions/workflows | jq '.workflows[] | select(.["state"] | contains("disabled_manually")) | .id'))

    foreach ($wf in $workflow_ids) {
        write-host "Listing runs for the workflow ID $wf"
        $run_ids = ( $(gh api repos/$org/$repo/actions/workflows/$wf/runs --paginate | jq '.workflow_runs[].id') )
        foreach ($r in $run_ids) {
            write-host "Deleting Run ID $r"
            gh api repos/$org/$repo/actions/runs/$r -X DELETE >/dev/null
        }
    }

time for tika

comments powered by Disqus