2020-02-29 19:33:20 -06:00
# Delete Package Versions
2020-01-29 10:13:06 -05:00
2023-01-05 14:05:04 +05:30
This action deletes versions of a package from [GitHub Packages ](https://github.com/features/packages ). This action will only delete a maximum of 100 versions in one run.
2022-07-01 11:34:51 +02:00
2020-02-29 19:33:20 -06:00
### What It Can Do
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
* Create a retention policy (delete all except n most recent pre-release versions)
2021-11-25 11:25:32 +05:30
* Delete all package versions except n most recent versions
2020-02-29 19:33:20 -06:00
* Delete oldest version(s)
2021-11-25 11:25:32 +05:30
* Ignore version(s) from deletion through regex
2023-01-05 10:08:06 +00:00
* 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
2021-11-23 10:28:51 +00:00
* Delete a single version
* Delete multiple versions
* Delete specific version(s)
2020-01-29 10:13:06 -05:00
2020-02-29 19:33:20 -06:00
# Usage
2020-01-29 10:13:06 -05:00
2020-02-29 19:33:20 -06:00
``` yaml
2023-01-05 17:18:58 +05:30
- uses : actions/delete-package-versions@v4
2020-02-29 19:33:20 -06:00
with :
# Can be a single package version id, or a comma separated list of package version ids.
# Defaults to an empty string.
package-version-ids :
2020-07-21 08:13:33 -07:00
2023-01-05 10:08:06 +00:00
# Owner of the package.
2020-02-29 19:33:20 -06:00
# Defaults to the owner of the repo executing the workflow.
2023-01-05 10:08:06 +00:00
# Required if deleting a version from a package hosted in a different org than the one executing the workflow.
2020-02-29 19:33:20 -06:00
owner :
# Name of the package.
2022-12-29 15:59:15 +05:30
# Required
2020-02-29 19:33:20 -06:00
package-name :
2023-01-05 10:08:06 +00:00
# Type of the package. Can be one of container, maven, npm, nuget, or rubygems.
2022-12-29 15:59:15 +05:30
# Required
package-type :
2020-02-29 19:33:20 -06:00
# The number of old versions to delete starting from the oldest version.
# Defaults to 1.
num-old-versions-to-delete :
2021-12-24 00:20:21 +05:30
# The number of latest versions to keep.
2023-01-05 10:08:06 +00:00
# This cannot be specified with `num-old-versions-to-delete`. By default, `min-versions-to-keep` takes precedence over `num-old-versions-to-delete`.
2021-12-20 09:45:54 +00:00
# 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.
2021-11-08 10:09:38 +00:00
min-versions-to-keep :
2021-11-23 10:28:51 +00:00
# The package versions to exclude from deletion.
# Takes regex for the version name as input.
2023-01-05 10:08:06 +00:00
# By default nothing is ignored. This is ignored when `delete-only-pre-release-versions` is true
2021-11-16 05:34:29 +00:00
ignore-versions :
2021-11-17 06:52:13 +00:00
# If true it will delete only the pre-release versions.
2021-11-17 17:27:33 +00:00
# The number of pre-release versions to keep can be set by using `min-versions-to-keep` value with this.
# When `min-versions-to-keep` is 0, all pre-release versions get deleted.
2021-11-16 05:34:29 +00:00
# Defaults to false.
2021-12-20 15:34:15 +05:30
# Cannot be used with `num-old-versions-to-delete` and `ignore-versions`.
2021-11-16 05:34:29 +00:00
delete-only-pre-release-versions :
2023-03-03 16:42:34 +05:30
# If true it will delete only the untagged versions in case of container package.
# Does not work for other package types and will be ignored.
2023-03-09 15:37:07 +05:30
# The number of untagged versions to keep can be set by using `min-versions-to-keep` value with this.
# When `min-versions-to-keep` is 0, all untagged versions get deleted.
2023-03-03 16:42:34 +05:30
# Defaults to false.
2023-03-09 15:37:07 +05:30
# Cannot be used with `num-old-versions-to-delete`.
2023-03-03 16:42:34 +05:30
delete-only-untagged-versions :
2020-02-29 19:33:20 -06:00
# The token used to authenticate with GitHub Packages.
# Defaults to github.token.
2023-01-05 10:08:06 +00:00
# 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.
2020-02-29 19:33:20 -06:00
# 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 :
```
2020-01-29 10:13:06 -05:00
2021-12-20 10:00:12 +00:00
# Valid Input Combinations
2022-12-29 17:43:25 +05:30
`owner` , `package-name` , `package-type` and `token` can be used with the following combinations in a workflow -
2021-12-20 10:00:12 +00:00
- `num-old-versions-to-delete`
- `min-versions-to-keep`
- `delete-only-pre-release-versions`
- `ignore-versions`
- `num-old-versions-to-delete` + `ignore-versions`
- `min-versions-to-keep` + `ignore-versions`
- `min-versions-to-keep` + `delete-only-pre-release-versions`
2023-03-09 15:31:35 +05:30
- `delete-only-untagged-versions`
- `min-versions-to-keep` + `delete-only-untagged-versions`
2021-12-20 10:00:12 +00:00
2020-02-29 19:33:20 -06:00
# Scenarios
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
- [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 )
2023-03-03 16:42:34 +05:30
- [Delete all untagged container versions except y latest untagged versions ](#delete-all-untagged-container-versions-except-y-latest-untagged-versions )
2023-01-05 10:08:06 +00:00
- [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 )
2023-03-03 16:42:34 +05:30
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
### Delete all pre-release versions except y latest pre-release package versions
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
__Example __
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete all pre-release package versions except latest 10
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
```yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
min-versions-to-keep: 10
delete-only-pre-release-versions: "true"
` ``
2023-01-05 10:08:06 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
__Example__
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
Delete all pre-release package versions except latest 10 from a repo not having access to package
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
owner: 'github'
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.GITHUB_PAT }}
min-versions-to-keep: 10
delete-only-pre-release-versions: "true"
` ``
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
<br>
2020-02-29 19:33:20 -06:00
2023-03-03 16:42:34 +05:30
### Delete all untagged container versions except y latest untagged versions
To delete all untagged versions of a container package except y latest untagged versions, the __package-name__, __package-type__, __min-versions-to-keep__ and __delete-only-untagged-versions__ inputs are required. __package-type__ must be container for this scenario.
__Example__
Delete all untagged versions except latest 10
` ``yaml
- uses: actions/delete-package-versions@v4
with:
package-name: 'test-package'
package-type: 'container'
min-versions-to-keep: 10
delete-only-untagged-versions: 'true'
` ``
<br>
2021-11-23 10:28:51 +00:00
### Delete all except y latest versions while ignoring particular package versions
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
__Example__
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete all except latest 3 package versions excluding major versions as per semver
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
2022-09-14 22:07:47 +02:00
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
min-versions-to-keep: 3
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
` ``
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
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__.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
__Example__
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete all except latest 3 package versions excluding major versions as per semver from a repo not having access to package
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
owner: 'github'
2022-09-14 22:07:47 +02:00
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.GITHUB_PAT }}
min-versions-to-keep: 3
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
` ``
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
<br>
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
### Delete oldest x number of versions while ignoring particular package versions
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
__Example__
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
Delete 3 oldest versions excluding major versions as per semver
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
2022-09-14 22:07:47 +02:00
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
num-old-versions-to-delete: 3
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
` ``
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
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.
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
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.
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
__Example__
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete 3 oldest versions excluding major versions as per semver from a repo not having access to package
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
owner: 'github'
2022-09-14 22:07:47 +02:00
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.PAT }}
num-old-versions-to-delete: 3
ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$'
` ``
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
<br>
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
### Delete all except y latest versions of a package
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
To delete all except y latest versions of a package hosted, the __package-name__ and __min-versions-to-keep__ inputs are required.
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
__Example__
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete all except latest 2 versions of a package hosted
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
min-versions-to-keep: 2
` ``
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
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.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
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__.
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
__Example__
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete all except latest 2 versions of a package hosted from a repo not having access to package
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
owner: 'github'
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.PAT }}
min-versions-to-keep: 2
` ``
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
<br>
2020-02-29 19:33:20 -06:00
2021-11-23 10:28:51 +00:00
### Delete oldest x number of versions of a package
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
To delete the oldest x number of versions of a package hosted, the __package-name__, and __num-old-versions-to-delete__ inputs are required.
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
__Example__
2020-01-29 10:13:06 -05:00
2023-01-05 10:08:06 +00:00
Delete the oldest 3 version of a package hosted
2020-01-29 10:13:06 -05:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
num-old-versions-to-delete: 3
` ``
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
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.
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
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__.
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
__Example__
2021-11-08 10:09:38 +00:00
2023-01-05 10:08:06 +00:00
Delete the oldest 3 version of a package hosted from a repo not having access to package
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
owner: 'github'
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
num-old-versions-to-delete: 3
token: ${{ secrets.GITHUB_PAT }}
` ``
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
<br>
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
### Delete oldest version of a package
2021-11-08 10:09:38 +00:00
2023-01-05 10:08:06 +00:00
To delete the oldest version of a package that is hosted, the __package-name__ input is required.
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
__Example__
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
` ``
2021-11-08 10:09:38 +00:00
2023-01-05 10:08:06 +00:00
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.
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
__Example__
2021-11-08 10:09:38 +00:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
owner: 'github'
package-name: 'test-package'
2022-12-29 15:59:15 +05:30
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.PAT }}
` ``
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
<br>
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
### Delete a specific version of a package
2021-11-16 05:34:29 +00:00
2023-01-05 10:08:06 +00:00
To delete a specific version of a package that is hosted, the __package-version-ids__ input is required.
2021-11-16 05:34:29 +00:00
2023-01-05 10:08:06 +00:00
Package version ids can be retrieved via the [GitHub REST API][api]
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
__Example__
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'
2022-12-29 15:59:15 +05:30
package-name: 'test-package'
package-type: 'npm'
2021-11-23 10:28:51 +00:00
` ``
2021-11-16 05:34:29 +00:00
2023-01-05 10:08:06 +00:00
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.
2021-11-17 17:27:33 +00:00
2023-01-05 10:08:06 +00:00
Package version ids can be retrieved via the [GitHub REST API][api]
2021-11-17 17:27:33 +00:00
2021-11-23 10:28:51 +00:00
__Example__
2021-11-17 17:27:33 +00:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'
2022-12-29 15:59:15 +05:30
package-name: 'test-package'
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.PAT }}
` ``
2021-11-17 17:27:33 +00:00
2021-11-23 10:28:51 +00:00
<br>
2021-11-17 17:27:33 +00:00
2021-11-23 10:28:51 +00:00
### Delete multiple specific versions of a package
2021-11-16 05:34:29 +00:00
2023-01-05 10:08:06 +00:00
To delete multiple specific versions of a package that is hosted, the __package-version-ids__ input is required.
2021-11-16 05:34:29 +00:00
2023-01-05 10:08:06 +00:00
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].
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
__Example__
2021-11-16 05:34:29 +00:00
2021-11-23 10:28:51 +00:00
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzQ5, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzUw'
2022-12-29 15:59:15 +05:30
package-name: 'test-package'
package-type: 'npm'
2021-11-23 10:28:51 +00:00
` ``
2023-01-05 10:08:06 +00:00
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.
2021-11-23 10:28:51 +00:00
2023-01-05 10:08:06 +00:00
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].
2021-11-23 10:28:51 +00:00
__Example__
` ``yaml
2023-01-05 17:18:58 +05:30
- uses: actions/delete-package-versions@v4
2021-11-23 10:28:51 +00:00
with:
package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzQ5, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzUw'
2022-12-29 15:59:15 +05:30
package-name: 'test-package'
package-type: 'npm'
2021-11-23 10:28:51 +00:00
token: ${{ secrets.PAT }}
` ``
2021-11-08 10:09:38 +00:00
2020-02-29 19:33:20 -06:00
# License
2020-07-21 08:13:33 -07:00
The scripts and documentation in this project are released under the [MIT License ](https://github.com/actions/delete-package-versions/blob/main/LICENSE )
2020-02-29 19:33:20 -06:00
2023-01-05 10:08:06 +00:00
[api]: https://docs.github.com/en/rest/packages
2020-02-29 19:33:20 -06:00
[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