R
Railwayβ€’15mo ago
Snuzzn

Can't run Railway CLI down command with project token

hey , it is possible to run the railway down command with railway project token without logging in. I'd like to use this in a github action workflow after running e2e tests on a staging environment.
- name: Remove Most Recent Deployment
run: railway down --yes
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
- name: Remove Most Recent Deployment
run: railway down --yes
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
Currently it's giving: Unauthorized. Please login with railway login
19 Replies
Percy
Percyβ€’15mo ago
Project ID: N/A
Snuzzn
Snuzznβ€’15mo ago
N/A
MantisInABox
MantisInABoxβ€’15mo ago
I believe you would need to be logged in, I don't think there is a way to use just the project ID, as it needs your auth token to interact with your resources
Snuzzn
Snuzznβ€’15mo ago
i see, so it's different to the railway up command?
MantisInABox
MantisInABoxβ€’15mo ago
Honestly, I am not 100% sure, I have not used the CLI for github actions.
Snuzzn
Snuzznβ€’15mo ago
- name: Deploy run: railway up env: RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} It's a bit confusing coz the above is working. So it looks like only certain commands are allowed
Brody
Brodyβ€’15mo ago
removing/restarting/re-deploying a service/deployment requires the use of the account token
Snuzzn
Snuzznβ€’15mo ago
ohh i didn't know there was an account token. I'll try that. Thank you! is the account token same as api token?
Snuzzn
Snuzznβ€’15mo ago
what's the expected variable name for the account token when running the command
Brody
Brodyβ€’15mo ago
isnt it RAILWAY_TOKEN?
Snuzzn
Snuzznβ€’15mo ago
when I use that, it seems to think I'm referring to project token: Project Token not found
Snuzzn
Snuzznβ€’15mo ago
it doent seem to work: Unauthorized. Please login with railway login
Brody
Brodyβ€’15mo ago
and you are giving it the api token from the account page?
Snuzzn
Snuzznβ€’15mo ago
yep
Brody
Brodyβ€’15mo ago
you might have to code up something that calls the api yourself
Snuzzn
Snuzznβ€’15mo ago
ahh i see, ok. I'll give that a go later. Thanks for your time πŸ™‚
Brody
Brodyβ€’15mo ago
no problem πŸ™‚
Want results from more Discord servers?
Add your server