Display repository commit count as the Synapsis version
Hop-State: A_06FP98T1AFPC938R80XJ3J0 Hop-Proposal: R_06FP98S721MFZV1BVBVDTK8 Hop-Task: T_06FP98D0VF530A9XJ2HHHWR Hop-Attempt: AT_06FP98D0VFKNWCN4EJD46YR
This commit is contained in:
@@ -14,9 +14,23 @@ function getBuildCommit(): string {
|
||||
}
|
||||
}
|
||||
|
||||
function getBuildCommitCount(): string {
|
||||
if (process.env.APP_COMMIT_COUNT) return process.env.APP_COMMIT_COUNT;
|
||||
|
||||
try {
|
||||
return execFileSync('git', ['rev-list', '--count', 'HEAD'], {
|
||||
cwd: process.cwd(),
|
||||
encoding: 'utf8',
|
||||
}).trim();
|
||||
} catch {
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
env: {
|
||||
APP_COMMIT: getBuildCommit(),
|
||||
APP_COMMIT_COUNT: getBuildCommitCount(),
|
||||
APP_BUILD_DATE: process.env.APP_BUILD_DATE || new Date().toISOString(),
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user