Login to Docker Hub stored in secretes has stopped working in GitHub Actions

I store login pair in secretes in a GH repo. I have a GitHub Actions workflow, which logins to Docker Hub with:

echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USER }} --password-stdin

This produces an error:

Error: Cannot perform an interactive login from a non TTY device

It was working 8 hours ago successfully, but stopped to work 4 hours ago. I have tested credentials locally and they work.

What could be a reason for this failure?

Hi @k-rus,

This could be a temporary issue, i checked with your code and it’s successful on my side.
My workflow: https://github.com/weide-zhou/ticket13/runs/752745274?check_suite_focus=true#step:3:35
Please check the secrets setting(you can update the secrets value to mak sure it contains the correct value), and try again.

Thanks

@weide-zhou Thank you for reply and referencing your workflow!
It still doesn’t work. I see that the secrets are represented as *** in your run, while in my case they are empty. So I guess it is an issue with secrets. I will investigate in this direction.

@weide-zhou Resetting secrets didn’t help. My workflow is: https://github.com/timescale/timescaledb-docker/actions/runs/129452170
I will test a separate workflow with just login as in your example.

I know what the problem. I use my fork, which doesn’t have access to secrets :man_facepalming:

Hi @k-rus,

Thanks for your reply! In your fork repo, you need to create the secrets to make sure they exists in the fork repo, otherwise workflow cannot get the value and will display as empty.

Thanks.

@weide-zhou
I created the secrets in my account, but running the workflows fail with the same issue. I guess it is due to actions being run in the main repo but from the fork.
If I push the branch directly to the main repo, it works.

It would be great if a meaningful error message can be provided, or this limitation can be described in the documentation.

Hi @k-rus,

It’s mentioned in the doc here:
secrets are not passed to the runner when a workflow is triggered from a forked repository.

If you create a pull request from fork repository, the workflow cannot get the secrets defined in the yaml file.

If you create secrets in fork repository, and create pull request between the branches insides the repository(not from fork), workflow can work fine with secrets.

Hope it’s clear.
Thanks

Thank you for pointing to the place in the documentation. I was double checking before writing my comment, but I still missed it :slight_smile: