Managing Environment Variables for Per-PR Deployment Branches
mechxsteam
HOBBYOP

4 months ago

How can I use separate environment variables for per-PR deployment branches without relying on the production branch as a base? One option is creating a staging branch to utilize its environment secrets, but deploying to staging feels wasteful. Ideally, I prefer maintaining a single production branch alongside per-PR branches. However, disconnecting the staging branch from GitHub causes deployment failures for per-PR branches.

Solved$10 Bounty

5 Replies

https://docs.railway.com/guides/environments
https://docs.railway.com/guides/public-api#graphiql-playground

You can create different environments for PRs.
You can also use the Public API to create environments and set its variables for different PRs (via Github Actions).


mechxsteam
HOBBYOP

4 months ago

Is there a github action that i can use ?


You can either use Railway’s CLI (just install Railway CLI and run the shell commands) or you can use curl to call Railway’s GQL endpoint.


mechxsteam
HOBBYOP

4 months ago

I see, tysm.



Status changed to Solved samgordon 4 months ago


Loading...