Retention of NuGet Packages on the server for x releases

I see in the below link details on the retention policies.

If I want to delete a set history of NuGet packages like keep the last 20 packages on the server (Currently the only option I have is retention of number of days.) So if a package is not updated for 30 days and if the retention value is 20 days then it will get deleted on the server. Is that accurate?

Is there a way to keep a clean-up of the NuGet based on the x number of historical packages that are needed?

Any help will be much appreciated. Thanks.

Hi Jabraham,
Currently for packages we only support a retention policy that evaluates based on a number of days rather than on checking their historical usage.
If you think this feature would add some value, feel free to add the suggestion to UserVoice along with how you think it might work and we may pick it up in a future build!
In the meantime, It may be possible to get a similar behavior using your own custom built scripts that hit the Octopus Deploy APIs. Remember Octopus Deploy has been built API first, so anything you can do through the portal, you can script and execute yourself.
Let me know if you take this approach and how it comes together.
Thanks for getting in touch.

Ahh. That helps. I posted it on the UserVoice site also. Cool idea BTW, to have this option to post it as a UserVoice rather than a feature request etc… :slight_smile: