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

HttpError: Package not found #64

Closed
kyzima-spb opened this issue Dec 8, 2022 · 3 comments
Closed

HttpError: Package not found #64

kyzima-spb opened this issue Dec 8, 2022 · 3 comments
Labels
type:question Further information is requested

Comments

@kyzima-spb
Copy link

Good day.

I tried using your action and got this error: HttpError: Package not found

- uses: vlaurin/action-ghcr-prune@main
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    user: ${{ github.repository_owner }}
    container: "gui"
    untagged: true
@vlaurin
Copy link
Owner

vlaurin commented Dec 8, 2022

This is most likely a permission issue.

To use this endpoint, you must authenticate using an access token with the packages:read and packages:delete scopes.
In addition:
[...]
If package_type is container, you must also have admin permissions to the container you want to delete.
source: https://octokit.github.io/rest.js/v18#packages-delete-package-version-for-user

I see that you are using the GitHub-provided secrets.GITHUB_TOKEN which I don't believe would ever have admin permissions to a container. I would advise to use a personal access token instead with permissions as per above.

@vlaurin vlaurin added the type:question Further information is requested label Dec 8, 2022
@kyzima-spb
Copy link
Author

Thanks, it worked with the personal token.

I'm guessing GITHUB_TOKEN doesn't have delete-only permissions because adding a new image works (push).

-
  name: Login to GitHub Container Registry
  uses: docker/login-action@v2
  with:
    registry: ghcr.io
    username: ${{ github.repository_owner }}
    password: ${{ secrets.GITHUB_TOKEN }}
-
  name: Build and push
  uses: docker/build-push-action@v3
  with:
    context: ./docker
    build-args: |
      RELEASE=${{ matrix.release }}
    push: true
    tags: ${{ steps.meta.outputs.tags }}
    labels: ${{ steps.meta.outputs.labels }}

@vlaurin vlaurin closed this as completed Dec 8, 2022
@mill1000
Copy link

mill1000 commented Sep 6, 2023

If anyone stumbles upon this in 2023, I was able to delete images using my GITHUB_TOKEN.

jobs:
  prune-pr-images:
    if: github.event_name == 'pull_request'
    runs-on: ubuntu-latest
    permissions:
      packages: write
    steps:
      - uses: vlaurin/action-ghcr-prune@v0.5.0
        with:
          container: ${{ env.CONTAINER_NAME }}
          token: ${{ secrets.GITHUB_TOKEN }}
          prune-tags-regexes: ^pr-${{github.event.pull_request.number}}
          # dry-run: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants