Why GitHub action fails to push the docker image?

906 views Asked by At

I have a lot of GitHub actions that push built docker images to the GitHub Container Repository.

Basically, what I do is to have two steps in my job:

      - name: Log in to GitHub Container Repository
        run: |
          echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
          
      - name: Push the image
        run: |
          docker push ghcr.io/organization_name_here/repository_name_here:latest

This works out of the box fo all of my organizations and repositories.

However, for one very particular repository, I get this error:

Run docker push ghcr.io/organization_name_here/repository_name_here:latest
The push refers to repository [ghcr.io/holismreact/webrtc]
e6ff916ab651: Preparing
9d5288bc1c41: Preparing
bf5ee69d004a: Preparing
20e664c3d99e: Preparing
b3031b5001d5: Preparing
a303372b2caa: Preparing
39982b2a789a: Preparing
a303372b2caa: Waiting
39982b2a789a: Waiting
denied: permission_denied: write_package
Error: Process completed with exit code 1.

How can I fix this?

1

There are 1 answers

0
Erik van Velzen On

This does not work for me either.

The workaround is to use a GitHub Personal Access Token (PAT) from one of the users in the organization.

echo "${{ secrets.DAVE_PERSONAL_ACCESS_TOKEN }}" | docker login ghcr.io -u DaveTheDeveloper --password-stdin

There is a whispering of a permission OrganizationPackages: write but it does not exist for me.