Comments (8)
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](https://private-user-images.githubusercontent.com/4059310/238945569-f5fafd98-7633-4f63-b4f6-f7c238db5b78.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU0NjY3MTYsIm5iZiI6MTcxNTQ2NjQxNiwicGF0aCI6Ii80MDU5MzEwLzIzODk0NTU2OS1mNWZhZmQ5OC03NjMzLTRmNjMtYjRmNi1mN2MyMzhkYjViNzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDUxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA1MTFUMjIyNjU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzNlNDhjZmVmZjY1ZjNiMWI4YzM0ZTNjYTlhODFkODNkZDUyYjQ0NWY1NjNiY2I4NmRjMzYyNTk2MGJkMjEyZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.GSJAMOa0TY5BGUqgGnl1BQYPNHMpjk3iGSLsk2MOfnI)
Hope it helps!
Cheers.
from delete-package-versions.
@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.
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.
i am having the same issue @lloeki did you find a way around this?
from delete-package-versions.
same issue here, version is 1.1.17
from delete-package-versions.
same issue here, version is 1.1.17
Using "Version ID" instead of "Version", it worked:
from delete-package-versions.
@pbaroni-mdlz how did you use it? Please share
from delete-package-versions.
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)
- Feature request - delete latest pre-release
- Udostępniam Ci plik „7792e020-9542-45ef-bba3-6248e29c8b2b” HOT 1
- Error: get versions API failed. Package not found. HOT 2
- How to delete the releases package built by github action HOT 1
- Error when using delete-package-versions from a different repo HOT 1
- Action is very complex because of handling both packages and containers.
- No way to only keep tagged versions with `min-versions-to-keep`
- Action failing on MacOS Ventura Self-Hosted Runner HOT 1
- Error: get versions API failed. Package not found. HOT 1
- `min-versions-to-keep` behaviour inconsistent with documentation HOT 2
- Add dry run parameter HOT 1
- ignore-versions doesn't work HOT 3
- delete-only-pre-release-versions: true tag as well as ignore-versions params is not working HOT 1
- No v5 tag created HOT 5
- delete-only-untagged-versions seems to eat also manifests of tagged versions HOT 3
- Error: Invalid input combination after upgrade to v5 HOT 4
- Error running on latest macOS runner
- Multi-arch containers HOT 4
- Feature request - with include-versions regexp HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delete-package-versions.