pleroma-fe/build/commit_hash.js
2026-01-06 16:22:52 +02:00

18 lines
385 B
JavaScript

import childProcess from 'child_process'
export const getCommitHash = () => {
const subst = '$Format:%h$'
if (!subst.match(/Format:/)) {
return subst
} else {
try {
return childProcess
.execSync('git rev-parse --short HEAD')
.toString()
.trim()
} catch (e) {
console.error('Failed run git:', e)
return 'UNKNOWN'
}
}
}