From 3a13857dc35e8b2a9b75bef099da2898b80c64bb Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Sun, 6 Feb 2022 16:58:11 -0600 Subject: [PATCH] maint/util ~ add `dwr` (for interactive removal of workflow runs from CLI) --- util/dwr.sh | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 util/dwr.sh diff --git a/util/dwr.sh b/util/dwr.sh new file mode 100644 index 000000000..ff1f81170 --- /dev/null +++ b/util/dwr.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +# `dwr` - delete workflow runs (by DJ Adams) +# ref: +# ref: [Mass deletion of GitHub Actions workflow runs](https://qmacro.org/autodidactics/2021/03/26/mass-deletion-of-github-actions-workflow-runs) @@ + +# LICENSE: "Feel free to steal, modify, or make fun of" (from ) + +# spell-checker:ignore (options) multi ; (people) DJ Adams * qmacro ; (words) gsub + +# Given an "owner/repo" name, such as "qmacro/thinking-aloud", +# retrieve the workflow runs for that repo and present them in a +# list. Selected runs will be deleted. Uses the GitHub API. + +# Requires gh (GitHub CLI) and jq (JSON processor) + +# First version + +set -o errexit +set -o pipefail + +declare repo=${1:?No owner/repo specified} + +jq_script() { + + cat <