GithubHelp home page GithubHelp logo

Comments (8)

rlaiola avatar rlaiola commented on June 18, 2024 1

I managed to get actions/delete-package-versions@v4 working using the actual version id on ghcr.io (not the digest). In order to obtain that for a package owned by a user, see the documentation here.

Listing package versions for a package owned by a user (cURL):

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/users/USERNAME/packages/PACKAGE_TYPE/PACKAGE_NAME/versions

Example (replace <YOUR-TOKEN> accordingly):

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>"\
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/users/rlaiola/packages/container/relax-docker/versions

A JSON will be returned. You need an id like the one in the image below.

Screen Shot 2023-05-16 at 20 51 24

Hope it helps!

Cheers.

from delete-package-versions.

pbaroni-mdlz avatar pbaroni-mdlz commented on June 18, 2024 1

@pbaroni-mdlz how did you use it? Please share

- name: Get Version ID from the Versions List
  id: version-id
  run: |
    curl -X GET -H "Authorization: Bearer ${{env.GITHUB_TOKEN}}" https://api.github.com/orgs/YOUR_ORG/packages/YOUR_PACKAGE_TYPE/YOUR_PACKAGE_NAME/versions >> $HOME/versionIds.json
      echo "VERSION_ID=$(jq -r '.[] | select(.name == "1.1.7").id' $HOME/versionIds.json)" >> $GITHUB_OUTPUT
- name: Print Version ID
  run: echo "The selected Version ID is ${{ steps.version-id.outputs.VERSION_ID }}"
- uses: actions/delete-package-versions@v4
  with:
    package-version-ids: '${{ steps.version-id.outputs.VERSION_ID }}'
    package-name: 'YOUR_PACKAGE_NAME'
    package-type: 'maven'

from delete-package-versions.

derpda avatar derpda commented on June 18, 2024 1

The documentation specifically lists below example

- uses: actions/delete-package-versions@v4
  with:
    package-version-ids: 'MDE0OlBhY2thZ2VWZXJzaW9uOTcyMDY3'
    package-name: 'test-package'
    package-type: 'npm'

As in, a string should be accepted, so this seems to be a bug.

As suggested in the same Readme, I get that string from the GitHub GraphQL API, not sure that an int version is even available there.
If there is an int verison, could someone let me know how to acquire it?

EDIT: Went back and checked on version 3.0.1, and it works fine there with a string. Something happened in between :)

from delete-package-versions.

iampeters avatar iampeters commented on June 18, 2024

i am having the same issue @lloeki did you find a way around this?

from delete-package-versions.

pbaroni-mdlz avatar pbaroni-mdlz commented on June 18, 2024

same issue here, version is 1.1.17

from delete-package-versions.

pbaroni-mdlz avatar pbaroni-mdlz commented on June 18, 2024

same issue here, version is 1.1.17

Using "Version ID" instead of "Version", it worked:

image

from delete-package-versions.

iampeters avatar iampeters commented on June 18, 2024

@pbaroni-mdlz how did you use it? Please share

from delete-package-versions.

abannachGrafana avatar abannachGrafana commented on June 18, 2024

I agree with this being a bug. I'm using this action with a workflow where I create a temporary container image to use as a service in other jobs and want to delete afterwards. I see my version as the tag on the container e.g. ghcr.io/foo/bar:my-version-1 would be version my-version-1. At the time of pushing my package via docker I would not know what the internal package id is, but I do know what the version tag is.

If there was an action that could build and publish my image and the output of that step was the package id i could use later that'd save having to do an API call and parsing the response.

from delete-package-versions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.