From 3b8da28fc874d73def4f53456c87d14b0d8b451b Mon Sep 17 00:00:00 2001 From: Milos Kaurin <2141359+Kaurin@users.noreply.github.com> Date: Sat, 31 Aug 2024 12:18:56 +0100 Subject: [PATCH] feat: Delete obsolete tags in parallel --- scripts/delete_gh_release_assets.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/delete_gh_release_assets.sh b/scripts/delete_gh_release_assets.sh index 1661793..9b83f98 100644 --- a/scripts/delete_gh_release_assets.sh +++ b/scripts/delete_gh_release_assets.sh @@ -3,6 +3,8 @@ set -e set -o pipefail +# You can run this script as-is. It will delete all assets in all tags except the assets in the latest tag. + # Delete all 7z files from a GitHub release # Usage: delete_gh_release_assets # Example: delete_gh_release_assets "v0.9.13+2023-06-18-001" @@ -10,8 +12,7 @@ function delete_gh_release_assets() { gh release view "$1" --json assets -q '.assets[].name' | grep '\.7z$' | xargs -n1 gh release delete-asset "$1" } -export -f delete_gh_release_assets - -# Deletes all assets from all releases except from the latest release +# Deletes all assets in parallel from all releases except from the latest release # Documentation: Call bash function via xargs: https://unix.stackexchange.com/questions/158564/how-to-use-defined-function-with-xargs -gh release list --json tagName -q '.[1:].[].tagName' | xargs -n1 bash -c 'delete_gh_release_assets "$@"' _ +export -f delete_gh_release_assets +gh release list --json tagName -q '.[1:].[].tagName' | xargs -P0 -n1 bash -c 'delete_gh_release_assets "$@"' _