Pushing to registry using GITHUB_TOKEN fails one hour (Token seems expired)

As the title says everything was working fine, until i transferred the repo from my personal account to the organization account. Now the action workflow can’t push new images onto the registry. The login works but the action fails with: 

Run docker login docker.pkg.github.com -u xxxxx -p *** 
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /home/runner/.docker/config.json.

Configure a credential helper to remove this warning. See
Login Succeeded
The push refers to repository [docker.pkg.github.com/xxxx/xxxx/build-xxxx]
028bd0a4055f: Preparing
a0482b2ad916: Preparing
e55237605e99: Preparing
c6638992f7d4: Preparing
bc8b8b853a17: Preparing
9762a95e7d15: Preparing
562cf8447811: Preparing
97041f29baff: Preparing
9762a95e7d15: Waiting
562cf8447811: Waiting
97041f29baff: Waiting
unauthorized: Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.
##[error]Process completed with exit code 1.

When using a personal access token and using the Docker cli everything is fine. When an actions pushes an update to the same tag (not a new one) everything is fine aswell…

This is the workflow

name: Build (xxxx1)

on: [deployment]


    runs-on: ubuntu-latest

    if: github.event.deployment.environment == 'xxxx1'

    - name: Checkout
      uses: actions/checkout@v1

    - name: Build
      run: |
        cd xxxx
        docker build --pull --build-arg xxxx=1 -t docker.pkg.github.com/xxxx/xxxx/build-xxxx1:latest -f Dockerfile .

    - name: Push
      run: |
        docker login docker.pkg.github.com -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
        docker push docker.pkg.github.com/xxxx/xxxx/build-xxxx1:latest

This sounds like a permission bug.

Thanks for helping!

Thank you for being here. I am afraid that I cannot reproduce your issue in my account.

Do you want to push to the current repo in organization? After transferring repo to organization, have you changed the owner name from your personal account to organization name when execute docker build and push command?   

docker push docker.pkg.github.com/xxxx/xxxx/build-xxxx1:latest

If you are using a public repo, it would be better if you share the repo link here.  

1 Like

Thanks for you answer.

Yes, i updated the repo link (from my personal to the org name).

Unfortunately this is a private repository which i cannot share public at the moment. Is there any place where i can submit this issue with details to my private repo?



Hi paresy, you’d need to contact support at https://support.github.com/


Done. Thanks!

I’m hitting this as well, what was the resolution here?

Unfortunately nothing comfortable/feasible. The proposed workaround was to dump the image from docker, save it as an artifact, proceed to the next job (which will refresh the token), restore the image from artifacts, load it into docker and then push it to the registry.