From a3ac67b0c3026bc335a33b722188e3ec769d6a64 Mon Sep 17 00:00:00 2001 From: Vedant Mohan Goyal <83997633+vedantmgoyal9@users.noreply.github.com> Date: Sat, 2 Nov 2024 23:59:46 +0530 Subject: [PATCH] fix: version isn't deleted if it's the only version and max-versions-to-keep is 1 Resolves #307 --- action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c5cd946..a6de3aa 100644 --- a/action.yml +++ b/action.yml @@ -90,7 +90,8 @@ runs: run: | # delete previous versions w.r.t. max-versions-to-keep (if any) $ToNatural = { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } - $Versions = komac list-versions '${{ inputs.identifier }}' --json | ConvertFrom-Json | Sort-Object $ToNatural -Descending + #[Issue #307] -NoEnumerate has been added so that $Versions does not get converted to a string, when only one version exists in winget-pkgs + $Versions = komac list-versions '${{ inputs.identifier }}' --json | ConvertFrom-Json -NoEnumerate | Sort-Object $ToNatural -Descending $Reason = 'This version is older than what has been set in `max-versions-to-keep` by the publisher.' If ($Versions.Count + 1 -gt ${{ inputs.max-versions-to-keep }}) {