Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b07b80d8b6 | ||
|
|
551e7bce3b |
@@ -144,7 +144,7 @@ runs:
|
||||
fi
|
||||
|
||||
# 獲取並排序所有版本 (按創建時間降序)
|
||||
SORTED_VERSIONS=$(echo "$VERSIONS_JSON" | jq -r '.versions | sort_by(.created_at) | reverse')
|
||||
SORTED_VERSIONS=$(echo "$VERSIONS_JSON" | jq '.versions | sort_by(.created_at) | reverse')
|
||||
|
||||
# 計算總數量
|
||||
TOTAL_COUNT=$(echo "$SORTED_VERSIONS" | jq 'length')
|
||||
@@ -161,7 +161,7 @@ runs:
|
||||
echo "需要刪除 $DELETE_COUNT 個舊映像"
|
||||
|
||||
# 獲取要刪除的版本 (跳過前 keep-count 個)
|
||||
TO_DELETE=$(echo "$SORTED_VERSIONS" | jq -r ".[${{ inputs.keep-count }}:]")
|
||||
TO_DELETE=$(echo "$SORTED_VERSIONS" | jq -r ".[${{ inputs.keep-count }}:] | .[] | {id: .id, name: .name, created_at: .created_at}")
|
||||
|
||||
# 初始化刪除計數器和列表
|
||||
DELETED_COUNT=0
|
||||
|
||||
Reference in New Issue
Block a user