Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
chore: add maintenance script for deleting workflow runs (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh committed Jul 21, 2023
1 parent e105cbc commit 3d44fff
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions scripts/delete-workflow-runs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -euo pipefail

if [ $# -ne 2 ]; then
echo "Usage: $0 <repo> <workflow>"
exit 1
fi

repo=$1
workflow=$2

runs="$(gh api "repos/$repo/actions/workflows/$workflow/runs" -X GET | jq '.workflow_runs | map(.id) | .[]')"

echo "$runs"

for run in $runs; do
echo "Deleting run $run"
gh api "repos/$repo/actions/runs/$run" -X DELETE | jq .message
done

0 comments on commit 3d44fff

Please sign in to comment.