Get PR Branch Name as Environment Variable
scarabcoder
PROOP

a year ago

Hi all,

If I turn on the PR Environments feature, is there a way to get the branch name as an environment variable? I'd like to use it to separate some of the services that the deployment may use, and as a flag for things like Sentry logging.

5 Replies

brody
EMPLOYEE

a year ago

You want RAILWAY_ENVIRONMENT_NAME

See this docs page for a list of other variables - https://docs.railway.app/reference/variables#railway-provided-variables


scarabcoder
PROOP

a year ago

Thanks, I also see RAILWAY_GIT_BRANCH in that list, would that be used in PR environments?


brody
EMPLOYEE

a year ago

Truthfully, I have not used PR environments myself so I would not know what that would evaluate to in a PR environment.

Nothing left to do but to try then!


scarabcoder
PROOP

a year ago

Will do, thank you!


brody
EMPLOYEE

a year ago

No problem! update when you find out please!


Loading...