Github Related Environment Variables missing
jigglyjams
HOBBYOP

2 years ago

I am having trouble accessing the github related environment variables for a project. The project is setup to deploy from github triggers and based on the docs here I was assuming I could access them by setting up a variable like:
RAILWAY_GIT_REPO_OWNER = ${{RAILWAY_GIT_REPO_OWNER}}

Is this not the case? How does one set this up? Thanks!

7 Replies

jigglyjams
HOBBYOP

2 years ago

c54e2141-8124-42c6-b31d-3158cb0a74a3


jigglyjams
HOBBYOP

2 years ago

1237468894722134000
1237468895074324500


2 years ago

those variables are auto injected, you can not set them yourself


jigglyjams
HOBBYOP

2 years ago

Do you know if its possible to access them from a nextjs project? Will they be prepended with NEXT_PUBLIC?


2 years ago

no they wouldn't, that's something you'd need to do in a pre-run script


jigglyjams
HOBBYOP

2 years ago

Got it!

modified next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  env: {
    RAILWAY_GIT_REPO_NAME: process.env.RAILWAY_GIT_REPO_NAME,
    RAILWAY_GIT_COMMIT_SHA: process.env.RAILWAY_GIT_COMMIT_SHA,
    RAILWAY_GIT_REPO_OWNER: process.env.RAILWAY_GIT_REPO_OWNER,
  }
};

export default nextConfig;

Could be useful to add to docs somewhere


2 years ago

glad you where able to solve


Loading...