delete-package-versions icon indicating copy to clipboard operation
delete-package-versions copied to clipboard

Error when deleting packages

Open DanJBower opened this issue 3 years ago • 1 comments

I'm using NuGet packages in my GitHub packages, and I've set up a manual workflow to allow me to delete all but the 5 latest versions. It looks like this

name: Delete Old CI Builds

on:
  workflow_dispatch:

jobs:
  DeleteOldCiBuilds:
	name: Delete old CI releases
	runs-on: ubuntu-latest
	steps:
	- name: Delete Package Versions
	  uses: actions/[email protected]
	  with:
		package-name: MyPackageName
		min-versions-to-keep: 5
		token: ${{ github.token }}

However, when it runs, I get the following error message

Error: delete version mutation failed. Type mismatch on variable $packageVersionId and argument packageVersionId (String! / ID!)

The only other strange thing I noticed is that even know I was only using min-versions-to-keep, num-old-versions-to-delete still showed up in the full output.

Full output

Run actions/[email protected]
  with:
	package-name: MyPackageName
	min-versions-to-keep: 5
	token: ***
	num-old-versions-to-delete: 1
	ignore-versions: ^$
	delete-only-pre-release-versions: false
(node:1564) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Total versions deleted till now: 2
Error: delete version mutation failed. Type mismatch on variable $packageVersionId and argument packageVersionId (String! / ID!)

Also, even though it says Total versions deleted till now: 2, I checked my package versions, and no versions have been deleted.

A sample of what the versioning looks like for the package is

  • 0.0.5-ci-2215317956
  • 0.0.5
  • 0.0.4
  • 0.0.2-ci-2215161916
  • 0.0.2-ci-2215112987

I'd really appreciate any help fixing the issue as I would like to add this to one of my scheduled workflows, but it was causing it to fail.

DanJBower avatar Apr 24 '22 11:04 DanJBower

Hi, You didn't specify the type of package, but is required (DOC)

You can try add the type of package: package-type: nuget

Updated script

name: Delete Old CI Builds

on:
  workflow_dispatch:

jobs:
  DeleteOldCiBuilds:
	name: Delete old CI releases
	runs-on: ubuntu-latest
	steps:
	- name: Delete Package Versions
	  uses: actions/[email protected]
	  with:
                package-type: nuget
		package-name: MyPackageName
		min-versions-to-keep: 5
		token: ${{ github.token }}

m3nax avatar Aug 09 '23 08:08 m3nax