Update README

This commit is contained in:
Anupam
2023-01-05 10:08:06 +00:00
parent 4833470995
commit 79269eb4bf
+55 -58
View File
@@ -8,8 +8,8 @@ This action deletes versions of a package from [GitHub Packages](https://github.
* Delete all package versions except n most recent versions
* Delete oldest version(s)
* Ignore version(s) from deletion through regex
* Delete version(s) of a package that is hosted in the same repo that is executing the workflow
* Delete version(s) of a package that is hosted in a different repo than the one executing the workflow
* Delete version(s) of a package that is hosted from a repo having access to package
* Delete version(s) of a package that is hosted from a repo not having access to package
* Delete a single version
* Delete multiple versions
* Delete specific version(s)
@@ -23,16 +23,16 @@ This action deletes versions of a package from [GitHub Packages](https://github.
# Defaults to an empty string.
package-version-ids:
# Owner of the repo hosting the package.
# Owner of the package.
# Defaults to the owner of the repo executing the workflow.
# Required if deleting a version from a package hosted in a different repo than the one executing the workflow.
# Required if deleting a version from a package hosted in a different org than the one executing the workflow.
owner:
# Name of the package.
# Required
package-name:
# Type of the package.
# Type of the package. Can be one of container, maven, npm, nuget, or rubygems.
# Required
package-type:
@@ -41,14 +41,14 @@ This action deletes versions of a package from [GitHub Packages](https://github.
num-old-versions-to-delete:
# The number of latest versions to keep.
# This cannot be specified with `num-old-versions-to-delete`. By default, `num-old-versions-to-delete` takes precedence over `min-versions-to-keep`.
# This cannot be specified with `num-old-versions-to-delete`. By default, `min-versions-to-keep` takes precedence over `num-old-versions-to-delete`.
# When set to 0, all deletable versions will be deleted.
# When set greater than 0, all deletable package versions except the specified number will be deleted.
min-versions-to-keep:
# The package versions to exclude from deletion.
# Takes regex for the version name as input.
# By default nothing is ignored.
# By default nothing is ignored. This is ignored when `delete-only-pre-release-versions` is true
ignore-versions:
# If true it will delete only the pre-release versions.
@@ -60,7 +60,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
# The token used to authenticate with GitHub Packages.
# Defaults to github.token.
# Required if deleting a version from a package hosted in a different repo than the one executing the workflow.
# Required if the repo running the workflow does not have access to delete the package.
# For rubygems and maven package, repo has access if package is hosted in the same repo as the workflow.
# For container, npm and nuget package, repo has access if assigned **Admin** role under Package Settings > Manage Actions Access.
# If `package-version-ids` is given the token only needs the delete packages scope.
# If `package-version-ids` is not given the token needs the delete packages scope and the read packages scope
token:
@@ -80,24 +82,29 @@ This action deletes versions of a package from [GitHub Packages](https://github.
# Scenarios
- [Delete all pre-release versions except y latest pre-release package versions](#delete-all-pre-release-versions-except-y-latest-pre-release-package-versions)
- [Delete all except y latest versions while ignoring particular package versions](#delete-all-except-y-latest-versions-while-ignoring-particular-package-versions)
- [Delete oldest x number of versions while ignoring particular package versions](#delete-oldest-x-number-of-versions-while-ignoring-particular-package-versions)
- [Delete all except y latest versions of a package](#delete-all-except-y-latest-versions-of-a-package)
- [Delete oldest x number of versions of a package](#delete-oldest-x-number-of-versions-of-a-package)
- [Delete oldest version of a package](#delete-oldest-version-of-a-package)
- [Delete a specific version of a package](#delete-a-specific-version-of-a-package)
- [Delete multiple specific versions of a package](#delete-multiple-specific-versions-of-a-package)
- [Delete Package Versions](#delete-package-versions)
- [What It Can Do](#what-it-can-do)
- [Usage](#usage)
- [Valid Input Combinations](#valid-input-combinations)
- [Scenarios](#scenarios)
- [Delete all pre-release versions except y latest pre-release package versions](#delete-all-pre-release-versions-except-y-latest-pre-release-package-versions)
- [Delete all except y latest versions while ignoring particular package versions](#delete-all-except-y-latest-versions-while-ignoring-particular-package-versions)
- [Delete oldest x number of versions while ignoring particular package versions](#delete-oldest-x-number-of-versions-while-ignoring-particular-package-versions)
- [Delete all except y latest versions of a package](#delete-all-except-y-latest-versions-of-a-package)
- [Delete oldest x number of versions of a package](#delete-oldest-x-number-of-versions-of-a-package)
- [Delete oldest version of a package](#delete-oldest-version-of-a-package)
- [Delete a specific version of a package](#delete-a-specific-version-of-a-package)
- [Delete multiple specific versions of a package](#delete-multiple-specific-versions-of-a-package)
- [License](#license)
### Delete all pre-release versions except y latest pre-release package versions
To delete all pre release versions except y latest pre-release package versions in the
as the workflow the __package-name__, __min-versions-to-keep__ and __delete-only-pre-release-versions__ inputs are required.
To delete all pre release versions except y latest pre-release package versions, the __package-name__, __min-versions-to-keep__ and __delete-only-pre-release-versions__ inputs are required.
__Example__
Delete all pre-release package versions except latest 10 in the same repo as the workflow
Delete all pre-release package versions except latest 10
```yaml
- uses: actions/delete-package-versions@v3
@@ -107,13 +114,11 @@ This action deletes versions of a package from [GitHub Packages](https://github.
min-versions-to-keep: 10
delete-only-pre-release-versions: "true"
```
To delete all pre release versions except y latest pre-release package versions in a different repo than the workflow the __owner__, __package-name__, __token__, __min-versions-to-keep__ and __delete-only-pre-release-versions__ inputs are required.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
To delete all pre release versions except y latest pre-release package versions from a repo not having access to package, the __owner__, __package-name__, __token__, __min-versions-to-keep__ and __delete-only-pre-release-versions__ inputs are required.
__Example__
Delete all pre-release package versions except latest 10 in a different repo than the workflow
Delete all pre-release package versions except latest 10 from a repo not having access to package
```yaml
- uses: actions/delete-package-versions@v3
@@ -130,11 +135,11 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete all except y latest versions while ignoring particular package versions
To delete all except y latest versions while ignoring particular package versions in the same repo as the workflow the __package-name__, __min-versions-to-keep__ and __ignore-versions__ inputs are required.
To delete all except y latest versions while ignoring particular package versions, the __package-name__, __min-versions-to-keep__ and __ignore-versions__ inputs are required.
__Example__
Delete all except latest 3 package versions excluding major versions as per semver in the same repo as the workflow
Delete all except latest 3 package versions excluding major versions as per semver
```yaml
- uses: actions/delete-package-versions@v3
@@ -145,13 +150,13 @@ This action deletes versions of a package from [GitHub Packages](https://github.
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
```
To delete all except y latest versions while ignoring particular package versions in a different repo than the workflow the __owner__, __package-name__, __token__, __min-versions-to-keep__ and __ignore-versions__ inputs are required.
To delete all except y latest versions while ignoring particular package versions from a repo not having access to package, the __owner__, __package-name__, __token__, __min-versions-to-keep__ and __ignore-versions__ inputs are required.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
__Example__
Delete all except latest 3 package versions excluding major versions as per semver in a different repo than the workflow
Delete all except latest 3 package versions excluding major versions as per semver from a repo not having access to package
```yaml
- uses: actions/delete-package-versions@v3
@@ -168,13 +173,13 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete oldest x number of versions while ignoring particular package versions
To delete oldest x number of versions while ignoring all the major package versions in the same repo as the workflow the __package-name__, __num-oldest-versions-to-delete__ and __ignore-versions__ inputs are required.
To delete oldest x number of versions while ignoring all the major package versions, the __package-name__, __num-oldest-versions-to-delete__ and __ignore-versions__ inputs are required.
There is a possibility if the oldest x number of versions contain ignored package versions, actual package versions to get deleted will be less than x.
__Example__
Delete 3 oldest versions excluding major versions as per semver is the same repo as the workflow
Delete 3 oldest versions excluding major versions as per semver
```yaml
- uses: actions/delete-package-versions@v3
@@ -185,15 +190,13 @@ This action deletes versions of a package from [GitHub Packages](https://github.
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
```
To delete oldest x number of versions while ignoring all the major package versions in a different repo than the workflow the __owner__, __package-name__, __token__, __num-oldest-versions-to-delete__ and __ignore-versions__ inputs are required.
To delete oldest x number of versions while ignoring all the major package versions from a repo not having access to package, the __owner__, __package-name__, __token__, __num-oldest-versions-to-delete__ and __ignore-versions__ inputs are required.
There is a possibility if the oldest x number of versions contain ignored package versions, actual package versions to get deleted will be less than x.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
__Example__
Delete 3 oldest versions excluding major versions as per semver is a different repo than the workflow
Delete 3 oldest versions excluding major versions as per semver from a repo not having access to package
```yaml
- uses: actions/delete-package-versions@v3
@@ -210,11 +213,11 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete all except y latest versions of a package
To delete all except y latest versions of a package hosted in the same repo as the workflow the __package-name__ and __min-versions-to-keep__ inputs are required.
To delete all except y latest versions of a package hosted, the __package-name__ and __min-versions-to-keep__ inputs are required.
__Example__
Delete all except latest 2 versions of a package hosted in the same repo as the workflow
Delete all except latest 2 versions of a package hosted
```yaml
- uses: actions/delete-package-versions@v3
@@ -224,13 +227,13 @@ This action deletes versions of a package from [GitHub Packages](https://github.
min-versions-to-keep: 2
```
To delete all except y latest versions of a package hosted in a repo other than the workflow the __owner__, __package-name__, __token__ and __min-versions-to-keep__ inputs are required.
To delete all except y latest versions of a package hosted from a repo not having access to package, the __owner__, __package-name__, __token__ and __min-versions-to-keep__ inputs are required.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
__Example__
Delete all except latest 2 versions of a package hosted in a repo other than the workflow
Delete all except latest 2 versions of a package hosted from a repo not having access to package
```yaml
- uses: actions/delete-package-versions@v3
@@ -246,11 +249,11 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete oldest x number of versions of a package
To delete the oldest x number of versions of a package hosted in the same repo as the workflow the __package-name__, and __num-old-versions-to-delete__ inputs are required.
To delete the oldest x number of versions of a package hosted, the __package-name__, and __num-old-versions-to-delete__ inputs are required.
__Example__
Delete the oldest 3 version of a package hosted in the same repo as the workflow
Delete the oldest 3 version of a package hosted
```yaml
- uses: actions/delete-package-versions@v3
@@ -260,13 +263,13 @@ This action deletes versions of a package from [GitHub Packages](https://github.
num-old-versions-to-delete: 3
```
To delete the oldest x number of versions of a package hosted in a different repo than the workflow the __owner__, __package-name__, __token__ and __num-old-versions-to-delete__ inputs are required.
To delete the oldest x number of versions of a package hosted from a repo not having access to package, the __owner__, __package-name__, __token__ and __num-old-versions-to-delete__ inputs are required.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
__Example__
Delete the oldest 3 version of a package hosted in a different repo than the one executing the workflow
Delete the oldest 3 version of a package hosted from a repo not having access to package
```yaml
- uses: actions/delete-package-versions@v3
@@ -282,7 +285,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete oldest version of a package
To delete the oldest version of a package that is hosted in the same repo as the workflow the __package-name__ input is required.
To delete the oldest version of a package that is hosted, the __package-name__ input is required.
__Example__
@@ -293,9 +296,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
package-type: 'npm'
```
To delete the oldest version of a package that is hosted in a different repo than the workflow the __owner__, __package-name__, __token__ inputs are required.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
To delete the oldest version of a package that is hosted from a repo not having access to package, the __owner__, __package-name__, __token__ inputs are required.
__Example__
@@ -312,9 +313,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete a specific version of a package
To delete a specific version of a package that is hosted in the same repo as the workflow the __package-version-ids__ input is required.
To delete a specific version of a package that is hosted, the __package-version-ids__ input is required.
Package version ids can be retrieved via the [GitHub GraphQL API][api]
Package version ids can be retrieved via the [GitHub REST API][api]
__Example__
@@ -326,11 +327,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
package-type: 'npm'
```
To delete a specific version of a package that is hosted in a different repo than the workflow the __package-version-ids__ and __token__ inputs are required.
To delete a specific version of a package that is hosted from a repo not having access to package, the __package-version-ids__ and __token__ inputs are required.
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
Package version ids can be retrieved via the [GitHub GraphQL API][api]
Package version ids can be retrieved via the [GitHub REST API][api]
__Example__
@@ -347,9 +346,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
### Delete multiple specific versions of a package
To delete multiple specific versions of a package that is hosted in the same repo as the workflow the __package-version-ids__ input is required.
To delete multiple specific versions of a package that is hosted, the __package-version-ids__ input is required.
The __package-version-ids__ input should be a comma separated string of package version ids. Package version ids can be retrieved via the [GitHub GraphQL API][api].
The __package-version-ids__ input should be a comma separated string of package version ids. Package version ids can be retrieved via the [GitHub REST API][api].
__Example__
@@ -361,11 +360,9 @@ This action deletes versions of a package from [GitHub Packages](https://github.
package-type: 'npm'
```
To delete multiple specific versions of a package that is hosted in a repo other than the workflow the __package-version-ids__, __token__ inputs are required.
To delete multiple specific versions of a package that is hosted from a repo not having access to package, the __package-version-ids__, __token__ inputs are required.
The __package-version-ids__ input should be a comma separated string of package version ids. Package version ids can be retrieved via the [GitHub GraphQL API][api].
The [token][token] needs the delete packages and read packages scope. It is recommended [to store the token as a secret][secret]. In this example the [token][token] was stored as a secret named __GITHUB_PAT__.
The __package-version-ids__ input should be a comma separated string of package version ids. Package version ids can be retrieved via the [GitHub REST API][api].
__Example__
@@ -382,7 +379,7 @@ This action deletes versions of a package from [GitHub Packages](https://github.
The scripts and documentation in this project are released under the [MIT License](https://github.com/actions/delete-package-versions/blob/main/LICENSE)
[api]: https://developer.github.com/v4/previews/#github-packages
[api]: https://docs.github.com/en/rest/packages
[token]: https://help.github.com/en/packages/publishing-and-managing-packages/about-github-packages#about-tokens
[secret]: https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets