R
Railway•10mo 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•10mo ago
Project ID: N/A
Snuzzn
Snuzzn•10mo ago
N/A
MantisInABox
MantisInABox•10mo 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•10mo ago
i see, so it's different to the railway up command?
MantisInABox
MantisInABox•10mo ago
Honestly, I am not 100% sure, I have not used the CLI for github actions.
Snuzzn
Snuzzn•10mo 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•10mo ago
removing/restarting/re-deploying a service/deployment requires the use of the account token
Snuzzn
Snuzzn•10mo 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•10mo ago
what's the expected variable name for the account token when running the command
Brody
Brody•10mo ago
isnt it RAILWAY_TOKEN?
Snuzzn
Snuzzn•10mo ago
when I use that, it seems to think I'm referring to project token: Project Token not found
Snuzzn
Snuzzn•10mo ago
it doent seem to work: Unauthorized. Please login with railway login
Brody
Brody•10mo ago
and you are giving it the api token from the account page?
Snuzzn
Snuzzn•10mo ago
yep
Brody
Brody•10mo ago
you might have to code up something that calls the api yourself
Snuzzn
Snuzzn•10mo ago
ahh i see, ok. I'll give that a go later. Thanks for your time 🙂
Brody
Brody•10mo ago
no problem 🙂