diff --git a/packages/docs/modules/banner/module.ts b/packages/docs/modules/banner/module.ts index 6637c2ee64..3b7e3ccd18 100644 --- a/packages/docs/modules/banner/module.ts +++ b/packages/docs/modules/banner/module.ts @@ -3,12 +3,15 @@ import { resolve } from 'pathe' import packageJson from '../../../ui/package.json' // This is an in-place way to figure out commit hash, -// but as we use railway, we have to use their variables. +// but as we use Netlify, we have to use their variables. // import { execSync } from 'child_process' // const getLastCommitHash = () => { // return execSync('git rev-parse HEAD').toString().trim() // } +// Netlify has several Git metadata read-only variables: COMMIT_REF, BRANCH, etc. +// see https://docs.netlify.com/configure-builds/environment-variables/#git-metadata for more details + /** Module used to add current file path to page-config */ export default defineNuxtModule({ meta: { @@ -20,9 +23,9 @@ export default defineNuxtModule({ exclude: './page-config/**/*.{.vue,.md}', }, - setup(options) { - if (!process.env.RAILWAY_GIT_COMMIT_SHA) { - console.warn("Banner module is disabled because RAILWAY_GIT_COMMIT_SHA is not present in .env") + setup() { + if (!process.env.COMMIT_REF) { + console.warn('Banner module is disabled because COMMIT_REF is not present in .env') return } @@ -32,8 +35,8 @@ export default defineNuxtModule({ options: { VERSION: packageJson.version, DATE: new Date().toLocaleString(), - COMMIT: process.env.RAILWAY_GIT_COMMIT_SHA.slice(0,7), // same as github commit shortcut - BRANCH: process.env.RAILWAY_GIT_BRANCH, + COMMIT: process.env.COMMIT_REF.slice(0,7), // same as GitHub commit shortcut + BRANCH: process.env.BRANCH, } }) }