From 8d64a08b7bfc272e40a45bfc99f1c6d8f4d719a7 Mon Sep 17 00:00:00 2001 From: Eleanor Demis Date: Tue, 18 Feb 2025 14:07:21 -0800 Subject: [PATCH] sort tags via semver --- delete-old-branches | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delete-old-branches b/delete-old-branches index 1cd6e4a..abe7b5f 100755 --- a/delete-old-branches +++ b/delete-old-branches @@ -119,7 +119,7 @@ main() { echo "deleted_branches=${deleted_branches[*]}" >> "$GITHUB_OUTPUT" if [[ "${DELETE_TAGS}" == true ]]; then local tag_counter=1 - for br in $(git ls-remote -q --tags --refs | sed "s@^.*tags/@@" | sort -rn); do + for br in $(git ls-remote -q --tags --refs | sed "s@^.*tags/@@" | sort -Vr); do if [[ -z "$(git log --oneline -1 --since="${DATE}" "${br}")" ]]; then if [[ ${tag_counter} -gt ${MINIMUM_TAGS} ]]; then extra_branch_or_tag_protected "${br}" "tag" && echo "tag: ${br} is explicitly protected and won't be deleted" && continue