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