Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'packages' of null #28

Open
ovidals opened this issue Aug 26, 2020 · 6 comments
Open

Cannot read property 'packages' of null #28

ovidals opened this issue Aug 26, 2020 · 6 comments

Comments

@ovidals
Copy link

ovidals commented Aug 26, 2020

Hi!

I'm using the following code to remove old versions from another repository wich is private:

 - uses: actions/delete-package-versions@v1
    with:
      owner: '---'
      repo: '---'
      package-name: '---'
      num-old-versions-to-delete: 1
      token: ${{ secrets.CI_PACKAGES_READ_DELETE_TOKEN }}

I have created a personal access token with read and write packages permissions and stored as secret on the repository that is firing the action, but this error is thrown:

Cannot read property 'packages' of null

Any help on this?

Thank you!

@firefart
Copy link

firefart commented Sep 16, 2020

Happens for me too when I use ghcr.io (https://docs.github.com/en/packages/getting-started-with-github-container-registry/migrating-to-github-container-registry-for-docker-images)

With this change images are now stored at org level and not package level, maybe this is causing the error

@firefart
Copy link

Looks like this is the problem as only repository packages are fetched using graqhQL

packages(first: 1, names: [$package]) {

@kc1r74p
Copy link

kc1r74p commented Jan 10, 2021

Have the same issue, @firefart do you know how to query the new ghcr stored versions ?
I used the GraphQL explorer but I do not seem to find any Docker packages, which I have on my private user.
I also found this information regarding the registry: https://github.community/t/ghcr-io-docker-http-api/130121
Maybe we can extend the current functionality to fetch from ghcr and then delete from there as well, and open a PR.
I Have the same use case as @ovidals

@aidmax
Copy link

aidmax commented Jan 11, 2021

Facing almost the same issue using ghcr.io:
Error: TypeError: Cannot read property 'node' of undefined

@kc1r74p
Copy link

kc1r74p commented Jan 11, 2021

After searching some more I also found this Info:
https://github.community/t/github-container-registry-ghcr-io-packages-not-appearing-in-api/130133
Basically there is no ETA when the GraphQL API will also give out/handle container images,
which would enable this action to almost directly work.

I also tried the docker catalog api directly, hoping we could implement it ourselves:
ghcr.io/v2/<owner>/<image>/tags/list
but it, with all permissions, just returns:
{ "errors": [ { "code": "DENIED", "message": "invalid token" } ] }

So the only way currently is the GH Frontend which can list/delete the images.
Well currently as far as I can tell is, that all we can do is wait.
The GH public roadmap also seems not to have much coming up for ghcr.

Also similiar request:
https://github.community/t/are-there-plans-to-support-deletions-of-images-in-ghcr/153728
Interesting quote from Staff very recently:

But we’re working on a delete API that could be used on PR merge. Hoping to have this out by end of month.

@kc1r74p
Copy link

kc1r74p commented Mar 22, 2021

So there was an update on: https://github.community/t/are-there-plans-to-support-deletions-of-images-in-ghcr/153728
which now offers the v3 REST API to list and delete containers from ghcr.io:
https://github.community/t/you-can-now-delete-and-restore-any-package-type-within-github-packages/162393

So I did a very rough integration to proof it is working:
main...kc1r74p:main

I used my fix version like this:

        name: Remove previous version
        uses:  kc1r74p/delete-package-versions@main
        with:
          owner: ${{ github.repository_owner }}
          package-name: '<package_name>'
          package-type: 'container'
          ignore-tag: 'latest'
          token: ${{ secrets.CR_PAT }}

I could try to get a PR going for this repo, just not sure if GraphQL will implement containers in the future which would deprecate this kind of fix.
@andymckay Could we get your opinion, might help to decide if we should integrate it or wait further.

Might also solve: #35

krzentner added a commit to rlworkgroup/garage that referenced this issue Oct 15, 2021
Hopefully this change can be reversed / changed once actions/delete-package-versions#28 is fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants