From 8ee9271c2e435fc45a92a8118ad672af3d00c01c Mon Sep 17 00:00:00 2001 From: Danel Kungla Date: Mon, 21 Jul 2025 14:59:29 +0300 Subject: [PATCH] feat: add commit hash to environment variables and create HealthPage component to display it --- app/health/page.tsx | 7 +++++++ next.config.mjs | 5 +++++ 2 files changed, 12 insertions(+) create mode 100644 app/health/page.tsx diff --git a/app/health/page.tsx b/app/health/page.tsx new file mode 100644 index 0000000..c60abea --- /dev/null +++ b/app/health/page.tsx @@ -0,0 +1,7 @@ +const HealthPage = () => { + const commit = process.env.NEXT_PUBLIC_COMMIT_HASH; + + return
{commit}
; +}; + +export default HealthPage; diff --git a/next.config.mjs b/next.config.mjs index b3763d7..b9669b1 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,5 +1,7 @@ import withBundleAnalyzer from '@next/bundle-analyzer'; +import { execSync } from 'child_process'; +const commitHash = execSync('git rev-parse --short HEAD').toString().trim(); const IS_PRODUCTION = process.env.NODE_ENV === 'production'; const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL; const ENABLE_REACT_COMPILER = process.env.ENABLE_REACT_COMPILER === 'true'; @@ -68,6 +70,9 @@ const config = { /** We already do linting and typechecking as separate tasks in CI */ eslint: { ignoreDuringBuilds: true }, typescript: { ignoreBuildErrors: true }, + env: { + NEXT_PUBLIC_COMMIT_HASH: commitHash, + }, }; export default withBundleAnalyzer({