Github actions with Railway CLI requires login?
snide
PROOP

a year ago

Hey. I'm trying to set up a CI with railway using Github actions. Essentially I'm trying to do the following

  • Create a preview url (environment) for a new PR.

  • Inject that environment with a some env vars (specifically a DB url).

  • Know the preview url location so I can run playwright tests against that URL.

I figured I'd need to use the Railway CLI to do this, but it's been pretty cumbersome. Essentially it fails because I need to login. Looking at the docs, it seems I can use RAILWAY_TOKEN or RAILWAY_API_TOKEN to bypass login. But it doesn't look like you can use railway link? How am I supposed to tell railway to create a new environment for the PR, and then up the result?

I see that railways provides automatic PR environments, but I don't see how I'd be able to provide the vars to it through CI without login and link? Am I missing something.

Solved

22 Replies

snide
PROOP

a year ago

c072dba5-3f3b-4711-9a14-60bf59770ad7


snide
PROOP

a year ago

Is there a way to create an environment programmatically?


snide
PROOP

a year ago

also, fwiw, im a pro, not a hobby user. don't know why discord hasn't updated


snide
PROOP

a year ago

i feel like something is set up wrong. If I enable "PR environments" in project settings, then my service that is connected to github, should create a new environment when I create a PR right?


snide
PROOP

a year ago

@Brody sorry for the ping. I see you in most of these help threads, just hoping i could get a response.


a year ago

i didn't think the cli provides a way to create new environments to begin with?


snide
PROOP

a year ago

It doesn't seem to. I guess what I'm wondering is how can I set up automated previews with railway if it can't? Seems like a pretty common use case?


a year ago

i dont think there is a good way to do it tbh


a year ago

Inject that environment with a some env vars
are you using an external database?


snide
PROOP

a year ago

Yes


a year ago

neon?


snide
PROOP

a year ago

Turso. Sqlite


snide
PROOP

a year ago

It shouldnt matter. I'm just looking for a way to programaticly generate an environment, and supply it with a variable.


a year ago

its not something we support right now unfortunately


snide
PROOP

a year ago

Huh. Ok. Guess railway won't work for me.


snide
PROOP

a year ago

Previews feel like a common use case.


a year ago

we just dont support passing in specific variables for the PR envs


a year ago

perhaps you could do something custom with doppler?


snide
PROOP

a year ago

I'll just look for a different platform. I wanted something like vercel, but not serverless.


snide
PROOP

a year ago

Thanks for answering my questions


a year ago

no problem!


a year ago

!s


Status changed to Solved brody about 1 year ago


Loading...