Hi there! I have a GitHub Action for testing Prefe...
# ask-community
y
Hi there! I have a GitHub Action for testing Prefect flows. Until recently, I could connect to Prefect Cloud using the following commands:
Copy code
prefect config set PREFECT_API_URL=${{ env.PREFECT_API_URL }}
prefect config set PREFECT_API_KEY=${{ secrets.PREFECT_API_KEY }}
prefect cloud login --key ${{ secrets.PREFECT_API_KEY }} --workspace ${{ env.PREFECT_WORKSPACE }}
The third line produces the following response:
Copy code
It looks like you're already authenticated on this profile.
? Would you like to reauthenticate? [y/N]:
When running these commands in a terminal, if I enter
y
I can login successfully. Is there any other way to connect to Prefect Cloud through the terminal / GithHub Actions so that I don't have to enter
y
again?
Without that, the Action is useless and pressing
y
manually is not feasible for my use-cases.
1
n
hey @Yanic Möller, in general you can use
prefect --no-prompt <some-command>
although in this case, if you set your api key and url as env vars, you shouldn't actually have to call
login
yourself, you should be able to do
Copy code
prefect config set PREFECT_API_URL=${{ env.PREFECT_API_URL }}
prefect config set PREFECT_API_KEY=${{ secrets.PREFECT_API_KEY }}
prefect cloud workspace set --workspace ${{ env.PREFECT_WORKSPACE }}
this may be a useful example where i do that
y
Thank you, @Nate! When changing the line to
prefect cloud workspace set --workspace ${{ env.PREFECT_WORKSPACE }}
it works just fine. 🙌 I've also tested the
prefect --no-prompt cloud login ...
approach. Here I still get the old undesired response. However, this is not a problem for me.
n
hmm yeah i think we would need to add some
-y
flag to the
login
command to avoid prompting, but great - glad that works for you!