Authenticating in CI fails
martinmiglio opened this issue · 1 comments
martinmiglio commented
After installing the CLI in GitHub actions, I cannot authenticate my client with a token.
I've tried setting the env var:
jobs:
turso-install-and-login:
runs-on: ubuntu-latest
steps:
- name: Install Turso CLI
env:
TURSO_INSTALL_SKIP_SIGNUP: 1
run: |
curl -sSfL https://get.tur.so/install.sh | bash;
- name: Sign in to Turso
run: |
export TURSO_API_TOKEN="${{ secrets.TURSO_API_TOKEN }}";
~/.turso/turso auth whoami
Met with this error after confirming that the secret is the same as the env var given by https://api.turso.tech?redirect=false
:
Error: token in TURSO_API_TOKEN env var is invalid. Update the env var with a valid value, or unset it to use a token from the configuration file
Trying to set the env var through the step's properties also results in the same:
...
- name: Sign in to Turso
env:
TURSO_API_TOKEN: ${{ secrets.TURSO_API_TOKEN }}
run: |
~/.turso/turso auth whoami
I have also tried setting the value directly to 'settings.json':
echo "{\"token\":\"${{ secrets.TURSO_API_TOKEN }}\"}" > ~\.config\turso\settings.json;
~/.turso/turso auth whoami
Met with this:
Error: could not create turso client: user not logged in, please login with turso auth login
Is there a better way to authenticate the CLI in CI?
avinassh commented
This looks fine and should work. Setting TURSO_API_TOKEN
is the right way. Example usage:
https://github.com/tursodatabase/turso-cli/blob/bd42935/.github/workflows/go.yml#L13
I would just double check if the token is correct