pleroma-fe/build/commit_hash.js
Henry Jameson 5ce2ce63be lint regex
2026-08-04 00:18:12 +03:00

18 lines
389 B
JavaScript

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