Skip to content

Instantly share code, notes, and snippets.

@danielTobon43
Created August 16, 2022 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielTobon43/8c33d3e37785b42c55dc12d9eaaa2133 to your computer and use it in GitHub Desktop.
Save danielTobon43/8c33d3e37785b42c55dc12d9eaaa2133 to your computer and use it in GitHub Desktop.
Delete Github Action workflow

Delete workflow Github Actions

  • disable workflow manually
  • run delete.sh script
#!/bin/bash
org=danielTobon43
repo=pointcloudToMesh
# Get workflow IDs with status "disabled_manually"
workflow_ids=($(gh api repos/$org/$repo/actions/workflows | jq '.workflows[] | select(.["state"] | contains("disabled_manually")) | .id'))
for workflow_id in "${workflow_ids[@]}"
do
echo "Listing runs for the workflow ID $workflow_id"
run_ids=( $(gh api repos/$org/$repo/actions/workflows/$workflow_id/runs --paginate | jq '.workflow_runs[].id') )
for run_id in "${run_ids[@]}"
do
echo "Deleting Run ID $run_id"
gh api repos/$org/$repo/actions/runs/$run_id -X DELETE >/dev/null
done
done
@danielTobon43
Copy link
Author

@dtcMLOps
Copy link

@dtcMLOps
Copy link

dtcMLOps commented Nov 25, 2022

sudo apt install -y jq

@dtcMLOps
Copy link

dtcMLOps commented Nov 25, 2022

run: gh auth login

generate a PAT TOKEN on Github

@dtcMLOps
Copy link

in org, you should enter the organization if its a private repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment