{"id":13529154,"url":"https://github.com/actions/delete-package-versions","last_synced_at":"2025-05-16T07:04:02.118Z","repository":{"id":40639605,"uuid":"237012274","full_name":"actions/delete-package-versions","owner":"actions","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-29T13:56:07.000Z","size":1959,"stargazers_count":373,"open_issues_count":55,"forks_count":87,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-05T20:04:51.285Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/actions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-29T15:13:04.000Z","updated_at":"2025-05-05T13:40:39.000Z","dependencies_parsed_at":"2024-02-01T11:45:13.403Z","dependency_job_id":"28be68c8-5c83-4bfc-ae2d-b45799db5745","html_url":"https://github.com/actions/delete-package-versions","commit_stats":{"total_commits":267,"total_committers":21,"mean_commits":"12.714285714285714","dds":0.6853932584269663,"last_synced_commit":"0635864898b476b1b4ba530fc7854286f20b360c"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fdelete-package-versions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fdelete-package-versions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fdelete-package-versions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actions%2Fdelete-package-versions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actions","download_url":"https://codeload.github.com/actions/delete-package-versions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485053,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:33.814Z","updated_at":"2025-05-16T07:04:02.100Z","avatar_url":"https://github.com/actions.png","language":"TypeScript","funding_links":[],"categories":["Official Resources","TypeScript"],"sub_categories":["Official Actions"],"readme":"# Delete Package Versions\n\nThis 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.\n\n### What It Can Do\n\n* Create a retention policy (delete all except n most recent pre-release versions)\n* Delete all package versions except n most recent versions\n* Delete oldest version(s)\n* Ignore version(s) from deletion through regex\n* Delete version(s) of a package that is hosted from a repo having access to package\n* Delete version(s) of a package that is hosted from a repo not having access to package\n* Delete a single version\n* Delete multiple versions\n* Delete specific version(s)\n\n# Usage\n\n```yaml\n- uses: actions/delete-package-versions@v5\n  with:\n  # Can be a single package version id, or a comma separated list of package version ids.\n  # Defaults to an empty string.\n  package-version-ids:\n\n  # Owner of the package.\n  # Defaults to the owner of the repo executing the workflow.\n  # Required if deleting a version from a package hosted in a different org than the one executing the workflow.\n  owner:\n\n  # Name of the package.\n  # Required\n  package-name:\n\n  # Type of the package. Can be one of docker (v4 or older), container (v5 or newer), maven, npm, nuget, or rubygems.\n  # Required\n  package-type:\n\n  # The number of old versions to delete starting from the oldest version.\n  # Defaults to 1.\n  num-old-versions-to-delete:\n\n  # The number of latest versions to keep.\n  # This cannot be specified with `num-old-versions-to-delete`. By default, `min-versions-to-keep` takes precedence over `num-old-versions-to-delete`.\n  # When set to 0, all deletable versions will be deleted.\n  # When set greater than 0, all deletable package versions except the specified number will be deleted.\n  min-versions-to-keep:\n\n  # The package versions to exclude from deletion.\n  # Takes regex for the version name as input.\n  # By default nothing is ignored. This is ignored when `delete-only-pre-release-versions` is true\n  ignore-versions:\n\n  # If true it will delete only the pre-release versions.\n  # The number of pre-release versions to keep can be set by using `min-versions-to-keep` value with this.\n  # When `min-versions-to-keep` is 0, all pre-release versions get deleted.\n  # Defaults to false.\n  # Cannot be used with `num-old-versions-to-delete` and `ignore-versions`.\n  delete-only-pre-release-versions:\n\n  # If true it will delete only the untagged versions in case of container package.\n  # Does not work for other package types and will be ignored.\n  # The number of untagged versions to keep can be set by using `min-versions-to-keep` value with this.\n  # When `min-versions-to-keep` is 0, all untagged versions get deleted.\n  # Defaults to false.\n  # Cannot be used with `num-old-versions-to-delete`.\n  delete-only-untagged-versions:\n\n  # The token used to authenticate with GitHub Packages.\n  # Defaults to github.token.\n  # Required if the repo running the workflow does not have access to delete the package.\n  #   For rubygems and maven package, repo has access if package is hosted in the same repo as the workflow.\n  #   For container, npm and nuget package, repo has access if assigned **Admin** role under Package Settings \u003e Manage Actions Access.\n  #   If `package-version-ids` is given the token only needs the delete packages scope.\n  #   If `package-version-ids` is not given the token needs the delete packages scope and the read packages scope\n  token:\n```\n\n# Valid Input Combinations\n\n`owner`, `package-name`, `package-type` and `token` can be used with the following combinations in a workflow - \n\n  - `num-old-versions-to-delete`\n  - `min-versions-to-keep` \n  - `delete-only-pre-release-versions`\n  - `ignore-versions`\n  - `num-old-versions-to-delete` + `ignore-versions`\n  - `min-versions-to-keep` + `ignore-versions`\n  - `min-versions-to-keep` + `delete-only-pre-release-versions`\n  - `delete-only-untagged-versions`\n  - `min-versions-to-keep` + `delete-only-untagged-versions`\n\n# Scenarios\n\n- [Delete Package Versions](#delete-package-versions)\n    - [What It Can Do](#what-it-can-do)\n- [Usage](#usage)\n- [Valid Input Combinations](#valid-input-combinations)\n- [Scenarios](#scenarios)\n    - [Delete all pre-release versions except y latest pre-release package versions](#delete-all-pre-release-versions-except-y-latest-pre-release-package-versions)\n    - [Delete all untagged container versions except y latest untagged versions](#delete-all-untagged-container-versions-except-y-latest-untagged-versions)\n    - [Delete all except y latest versions while ignoring particular package versions](#delete-all-except-y-latest-versions-while-ignoring-particular-package-versions)\n    - [Delete oldest x number of versions while ignoring particular package versions](#delete-oldest-x-number-of-versions-while-ignoring-particular-package-versions)\n    - [Delete all except y latest versions of a package](#delete-all-except-y-latest-versions-of-a-package)\n    - [Delete oldest x number of versions of a package](#delete-oldest-x-number-of-versions-of-a-package)\n    - [Delete oldest version of a package](#delete-oldest-version-of-a-package)\n    - [Delete a specific version of a package](#delete-a-specific-version-of-a-package)\n    - [Delete multiple specific versions of a package](#delete-multiple-specific-versions-of-a-package)\n- [License](#license)\n\n\n  ### Delete all pre-release versions except y latest pre-release package versions\n\n  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.\n\n  __Example__\n\n  Delete all pre-release package versions except latest 10\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      package-name: 'test-package'\n      package-type: 'npm'\n      min-versions-to-keep: 10\n      delete-only-pre-release-versions: \"true\"\n  ```\n  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.\n\n  __Example__\n\n  Delete all pre-release package versions except latest 10 from a repo not having access to package\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      owner: 'github'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.GITHUB_PAT }}\n      min-versions-to-keep: 10\n      delete-only-pre-release-versions: \"true\"\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete all untagged container versions except y latest untagged versions\n\n  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.\n\n  __Example__\n\n  Delete all untagged versions except latest 10\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      package-name: 'test-package'\n      package-type: 'container'\n      min-versions-to-keep: 10\n      delete-only-untagged-versions: 'true'\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete all except y latest versions while ignoring particular package versions\n\n  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.\n\n  __Example__\n\n  Delete all except latest 3 package versions excluding major versions as per semver\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      package-name: 'test-package'\n      package-type: 'npm'\n      min-versions-to-keep: 3\n      ignore-versions: '^(0|[1-9]\\\\d*)\\\\.0\\\\.0$'\n  ```\n\n  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.\n\n  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__.\n\n  __Example__\n\n  Delete all except latest 3 package versions excluding major versions as per semver from a repo not having access to package\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      owner: 'github'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.GITHUB_PAT }}\n      min-versions-to-keep: 3\n      ignore-versions: '^(0|[1-9]\\\\d*)\\\\.0\\\\.0$'\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete oldest x number of versions while ignoring particular package versions\n\n  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.\n\n  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.\n\n  __Example__\n\n  Delete 3 oldest versions excluding major versions as per semver\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      package-name: 'test-package'\n      package-type: 'npm'\n      num-old-versions-to-delete: 3\n      ignore-versions: '^(0|[1-9]\\\\d*)\\\\.0\\\\.0$'\n  ```\n\n  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.\n\n  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.\n\n  __Example__\n\n  Delete 3 oldest versions excluding major versions as per semver from a repo not having access to package\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with: \n      owner: 'github'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.PAT }}\n      num-old-versions-to-delete: 3\n      ignore-versions: '^(0|[1-9]\\\\d*)\\\\.0\\\\.0$'\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete all except y latest versions of a package\n\n  To delete all except y latest versions of a package hosted, the __package-name__ and __min-versions-to-keep__ inputs are required.\n\n  __Example__\n\n  Delete all except latest 2 versions of a package hosted\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-name: 'test-package'\n      package-type: 'npm'\n      min-versions-to-keep: 2\n  ```\n\n  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.\n\n  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__.\n\n  __Example__\n\n  Delete all except latest 2 versions of a package hosted from a repo not having access to package\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      owner: 'github'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.PAT }}\n      min-versions-to-keep: 2\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete oldest x number of versions of a package\n\n  To delete the oldest x number of versions of a package hosted, the __package-name__, and __num-old-versions-to-delete__ inputs are required.\n\n  __Example__\n\n  Delete the oldest 3 version of a package hosted\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-name: 'test-package'\n      package-type: 'npm'\n      num-old-versions-to-delete: 3\n  ```\n\n  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.\n\n  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__.\n\n  __Example__\n\n  Delete the oldest 3 version of a package hosted from a repo not having access to package\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      owner: 'github'\n      package-name: 'test-package'\n      package-type: 'npm'\n      num-old-versions-to-delete: 3\n      token: ${{ secrets.GITHUB_PAT }}\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete oldest version of a package\n\n  To delete the oldest version of a package that is hosted, the __package-name__ input is required.\n\n  __Example__\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-name: 'test-package'\n      package-type: 'npm'\n  ```\n\n  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.\n\n  __Example__\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      owner: 'github'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.PAT }}\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete a specific version of a package\n\n  To delete a specific version of a package that is hosted, the __package-version-ids__ input is required.\n\n  Package version ids can be retrieved via the [GitHub REST API][api]\n\n  __Example__\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'\n      package-name: 'test-package'\n      package-type: 'npm'\n  ```\n\n  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.\n\n  Package version ids can be retrieved via the [GitHub REST API][api]\n\n  __Example__\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.PAT }}\n  ```\n\n  \u003cbr\u003e\n\n  ### Delete multiple specific versions of a package\n\n  To delete multiple specific versions of a package that is hosted, the __package-version-ids__ input is required.\n\n  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].\n\n  __Example__\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzQ5, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzUw'\n      package-name: 'test-package'\n      package-type: 'npm'\n  ```\n\n  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.\n\n  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].\n\n  __Example__\n\n  ```yaml\n  - uses: actions/delete-package-versions@v5\n    with:\n      package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzQ5, MDE0OlBhY2thZ2VWZXJzaW9uOTcyMzUw'\n      package-name: 'test-package'\n      package-type: 'npm'\n      token: ${{ secrets.PAT }}\n  ```\n\n# License\n\nThe scripts and documentation in this project are released under the [MIT License](https://github.com/actions/delete-package-versions/blob/main/LICENSE)\n\n[api]: https://docs.github.com/en/rest/packages\n[token]: https://help.github.com/en/packages/publishing-and-managing-packages/about-github-packages#about-tokens\n[secret]: https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions%2Fdelete-package-versions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factions%2Fdelete-package-versions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factions%2Fdelete-package-versions/lists"}