Skip to content

Conversation

@NamrataJha
Copy link
Contributor

@NamrataJha NamrataJha commented Nov 8, 2021

This PR adds

  • A min-versions-to-keep option for setting a lower limit on package versions while deleting.
  • A ignore-versions option to set regex for packages to be ignored while deletion.
  • A delete-only-pre-release-versions option to delete only the pre-release versions for a package
  • This integrates the changes from PR #29, PR #10 and resolves additional conflicts on those branches.

New Feature

  • Specify a minimum number of latest package versions to always keep while deleting.
    • Use the min-versions-to-keep attribute with the action workflow.
    • This is not a mandatory field for running the action. When not specified, by default the value is 0 and at every run num-old-versions-to-delete package versions will get deleted.
    • When min-versions-to-keep is set to any value greater than 0, it will delete maximum possible package versions except min-versions-to-keep package versions.
  • Specify package versions to ignore while deletion by regex pattern.
    • Use the ignore-versions attribute within the action workflow.
    • This is not a mandatory field. By default, no package version will be ignored.
  • Set to delete only pre-release versions.
    • Use the delete-only-pre-release-versions attribute with the action workflow.
    • This is not a mandatory field for running the action. By default, this is set to "false".
    • When "true", number of pre-release versions to keep can be set using min-versions-to-keep with this option.

What to Test

  • Test using the latest commit of delete-package-versions action - actions/delete-package-versions@6fee3def5eefbcb45b0ab364630c00099189e727 to use the changes.
  • Specify value for min-versions-to-keep ignore-versions and delete-only-pre-release-versions and see if the behaviour is expected.

@NamrataJha NamrataJha marked this pull request as ready for review November 8, 2021 08:10
@NamrataJha NamrataJha requested a review from a team as a code owner November 8, 2021 08:10
@nadesu
Copy link
Contributor

nadesu commented Nov 8, 2021

@NamrataJha - pls add more details to description as to how the new features of Action can be used, its spec, etc.

@nadesu
Copy link
Contributor

nadesu commented Nov 9, 2021

@NamrataJha - pls work with @jcansdale for any feedback

Copy link
Contributor

@nishthaGupta nishthaGupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

@NamrataJha
Copy link
Contributor Author

Have added an additional option ignore-versions to filter out packages to be deleted.

Copy link

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be a little more conservative about what versions we default to keeping. See inline comment for suggestion.

@NamrataJha
Copy link
Contributor Author

@jcansdale as per our discussion have updated to the action to-

  • remove ignore-versions default value. No package version will be ignored by default.
  • By default min-versions-to-keep is set to 1.
  • By default num-old-versions-to-delete is set to 1.
  • delete-only-pre-release-versions is the option for deleting all pre-release versions. This is false by default.
  • When delete-only-pre-release-versions is set to true, min-versions-to-keep is set to 0, num-old-versions-to-delete is set to 100 and ignore-versions is set to ^(0|[1-9]\\d*)((\\.(0|[1-9]\\d*))*)$ which includes all the release versions.

@AmrutaKawade Have made the above changes in the action and updated the README.md. Please review this once.

@NamrataJha NamrataJha requested review from AmrutaKawade and removed request for nishthaGupta November 16, 2021 05:52
Copy link

@AmrutaKawade AmrutaKawade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

README.md Outdated
# Cannot be more than 100
min-versions-to-keep:

# The package versions to ignore exclude from deletion.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we update the text to suggest that we are supporting regex here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will make the change.

Copy link

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions to make the new functionality more prominent/discoverable.

README.md Outdated
* Delete version(s) of a package that is hosted in a different repo than the one executing the workflow
* Delete maximum possible package versions except n latest versions
* Ignore some versions based on name from deletion
* Delete only pre-release versions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we say something like this:

  • Create a retention policy (delete all except n most recent pre-release versions)

And move this more common scenario to the top.

README.md Outdated
- [Delete all except y latest versions of a package hosted in a different repo than the workflow](#delete-all-except-y-latest-versions-of-a-package-hosted-in-a-different-repo-than-the-workflow)
- [Delete oldest x number of versions while ignoring particular package versions in the same repo as the workflow](#delete-oldest-x-number-of-versions-while-ignoring-particular-package-versions-in-the-same-repo-as-the-workflow)
- [Delete all except y latest versions while ignoring particular package versions in the same repo as the workflow](#delete-all-except-y-latest-versions-while-ignoring-particular-package-versions-in-the-same-repo-as-the-workflow)
- [Delete only pre-release package versions except y no of pre-release package versions in the same repo as the workflow](#delete-only-pre-release-package-versions-except-y-no-of-pre-release-package-versions-in-the-same-repo-as-the-workflow)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these two to the top?

I suspect the current top one, Delete a specific version of a package, is rarely if ever used! 😉

Copy link

@jcansdale jcansdale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. 👍🏻

@NamrataJha NamrataJha merged commit b19f4fe into main Nov 23, 2021
@NamrataJha NamrataJha deleted the keep-min-packages branch November 25, 2021 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants