delete-package-versions icon indicating copy to clipboard operation
delete-package-versions copied to clipboard

Delete oldest x number of versions of a package but keep a minimum

Open jaschaio opened this issue 4 years ago • 3 comments

Honestly this could probably be more easily accomplished with implementing https://github.com/actions/delete-package-versions/issues/5 (keep only N latest versions of package) but how would I keep a minimum number of versions of a package?

If I just use the example:

- uses: actions/delete-package-versions@v1
  with:
    package-name: 'test-package'
    num-old-versions-to-delete: 10

This would delete the 10 oldest versions. But what if I only have 8 versions?

What if I want to at least keep the last three versions around?

jaschaio avatar May 28 '20 19:05 jaschaio

For people subscribed to this thread, someone already wrote a PR implementing this: https://github.com/actions/delete-package-versions/pull/29

leonardehrenfried avatar Oct 28 '20 13:10 leonardehrenfried

My use case is always to keep few versions and never to delete a fixed number of versions whatever remains. Then I have used https://github.com/marketplace/actions/remove-package-versions-from-github-packages although it runs on Linux only.

pberthonneau avatar Jan 29 '21 17:01 pberthonneau

This should be implemented in the latest version of this action. I think this can be closed.

sandstrom avatar May 30 '23 12:05 sandstrom