{"id":21086402,"url":"https://github.com/aegenet/gh-delete-package-versions","last_synced_at":"2026-05-14T05:33:30.512Z","repository":{"id":152370617,"uuid":"625663294","full_name":"aegenet/gh-delete-package-versions","owner":"aegenet","description":"This action deletes versions of a package from GitHub Packages (forked from actions/delete-package-versions)","archived":false,"fork":false,"pushed_at":"2024-01-14T13:59:03.000Z","size":2148,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-15T22:10:08.931Z","etag":null,"topics":["action","github","package"],"latest_commit_sha":null,"homepage":"","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/aegenet.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-09T19:59:04.000Z","updated_at":"2024-01-15T09:13:59.000Z","dependencies_parsed_at":"2024-11-19T20:45:47.839Z","dependency_job_id":"915f5ff4-74c6-451a-9eef-410c2a8610ed","html_url":"https://github.com/aegenet/gh-delete-package-versions","commit_stats":null,"previous_names":["aegenet/delete-package-versions"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aegenet%2Fgh-delete-package-versions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aegenet%2Fgh-delete-package-versions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aegenet%2Fgh-delete-package-versions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aegenet%2Fgh-delete-package-versions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aegenet","download_url":"https://codeload.github.com/aegenet/gh-delete-package-versions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243528352,"owners_count":20305407,"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":["action","github","package"],"created_at":"2024-11-19T20:44:47.448Z","updated_at":"2026-05-14T05:33:25.464Z","avatar_url":"https://github.com/aegenet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Delete Package Versions\n\nThis action deletes versions of a package from [GitHub Packages](https://github.com/features/packages).\n\nThis is a fork of https://github.com/actions/delete-package-versions.\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* Include version(s) to 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: aegenet/gh-delete-package-versions@v5.5.0\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  package-name:\n\n  # Comma separated string of package names containing the version to delete.\n  # Alternative to package-name\n  package-names:\n\n  # Type of the package. Can be one of container, 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  # The package versions to include from deletion.\n  # Takes regex for the version name as input.\n  # By default all versions are included\n  include-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  # Display the deleted package versions and the list of preserved versions.\n  # Defaults to false.\n  verbose:\n\n  # Does not actually delete data, allows for simulation only.\n  # Defaults to false.\n  simulate:\n\n  # Sleep interval (ms) between deletion of versions per project (only when using package-names)\n  # Defaults to 15000 (15 seconds).\n  sleep-interval:\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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: aegenet/gh-delete-package-versions@v5.5.0\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/aegenet/gh-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%2Faegenet%2Fgh-delete-package-versions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faegenet%2Fgh-delete-package-versions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faegenet%2Fgh-delete-package-versions/lists"}