I am using GitHub workflows to push a small package to a private GH container registry. Yesterday most of my workflows went through, but suddenly they stop working. I am not aware of any recent setting changes.
I am using {{ secrets.GITHUB_TOKEN}} with Workflow write permissions enabled.
I replaced my actual organization name with test-user for privacy reasons.
buildx failed with: ERROR: failed to solve: failed to push test-user/bar:1.8.2:
failed to authorize: failed to fetch oauth token: unexpected status: 401 Unauthorized
This is an extract of my workflow file:
- name: Login to Docker 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@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Any idea what could trigger the 401?

Make sure you are only pushing images with the
ghcr.io/prefix in the name. Otherwise, it will try to push to docker hub and fail if you haven't used the login action to login to docker hub.