From 7282d80260d3c9edb5dcd6762db3d071563a5a30 Mon Sep 17 00:00:00 2001 From: Ruben Gees Date: Fri, 26 Mar 2021 15:59:05 +0100 Subject: [PATCH] Update docs and bump version --- README.md | 34 ++++++++++++++++++++++++---------- package.json | 2 +- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5942075..e12f587 100644 --- a/README.md +++ b/README.md @@ -5,31 +5,35 @@ Github action for deleting old versions of packages in the Github package regist This is very similar to [actions/delete-package-versions](https://github.com/actions/delete-package-versions) but targets a different use case. -The action works by getting at most 20 packages with at most the oldest 100 versions, -applying either the `version` or `version-pattern` and `keep` filters on them and then deleting the matching versions. +The action works by getting at most 20 packages with at most the oldest 100 versions of each, applying the filters (see +table below) on them and then deleting the matching versions. > If you have more than 100 versions and none of the 100 oldest versions match, no packages will be deleted! ### Inputs | Name | Description | Required | Default | -|-------------------|------------------------------------------------------------|--------------------|---------------| +| ----------------- | ---------------------------------------------------------- | ------------------ | ------------- | | `owner` | Owner of the repo containing the package(s) | :x: | Set by Github | | `repo` | Repo containing the package(s) | :x: | Set by Github | | `names` | Names of the packages | :heavy_check_mark: | :x: | -| `version-pattern` | Regex pattern of the versions | :x: | `^.+$` | -| `version` | Specific version to delete | :x: | null | +| `semver-pattern` | [Semver](https://semver.org/) range of the versions | :x: | `^.+$` | +| `version-pattern` | Regex pattern of the versions | :x: | :x: | +| `version` | Specific version to delete | :x: | :x: | | `keep` | Number of versions to exclude from deletions | :x: | 2 | | `token` | Token with the necessary scopes to delete package versions | :x: | Set by Github | +| `dry-run` | If the action should only print what it would do. | :x: | `false` | -> If you provide a `version` key, then `keep` and `version-pattern` must be empty or an error will be thrown. +> :warning: You can provide _either_ `version`, `semver-pattern` or `version-pattern`. An error is thrown for invalid combinations. + +> :warning: `keep` can not be set when `version` is set. ### Example usage > Delete old versions of the packages "package-1" and "package-2". ```yaml -uses: smartsquaregmbh/delete-old-packages@v0.2.0 +uses: smartsquaregmbh/delete-old-packages@v0.3.0 with: names: | package-1 @@ -39,17 +43,27 @@ with: > Delete old versions in the form of "1.0.0-RC1" of the package "package" ```yaml -uses: smartsquaregmbh/delete-old-packages@v0.2.0 +uses: smartsquaregmbh/delete-old-packages@v0.3.0 with: version-pattern: "^\\d+\\.\\d+\\.\\d+-RC\\d+$" # The regex needs to be escaped! names: | package ``` +> Delete old versions with a lower semver version than 2.x of the package "package" + +```yaml +uses: smartsquaregmbh/delete-old-packages@v0.3.0 +with: + semver-pattern: "<2.x" + names: | + package +``` + > Delete old versions of the package "package" but keep at least 5 versions ```yaml -uses: smartsquaregmbh/delete-old-packages@v0.2.0 +uses: smartsquaregmbh/delete-old-packages@v0.3.0 with: keep: 5 names: | @@ -59,7 +73,7 @@ with: > Delete version `foo-bar` of the package "package" ```yaml -uses: smartsquaregmbh/delete-old-packages@v0.2.0 +uses: smartsquaregmbh/delete-old-packages@v0.3.0 with: version: foo-bar names: | diff --git a/package.json b/package.json index 260b9af..080c165 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "delete-old-packages", - "version": "0.2.0", + "version": "0.3.0", "description": "Github Action for deleting old packages", "main": "dist/index.js", "repository": "https://github.com/SmartsquareGmbH/delete-old-packages",