pleroma-fe/build/commit_hash.js

18 lines
389 B
JavaScript
Raw Normal View History

2026-08-04 00:08:58 +03:00
import childProcess from 'node:child_process'
2025-02-28 14:03:43 -05:00
2026-01-06 16:22:52 +02:00
export const getCommitHash = () => {
const subst = '$Format:%h$'
2026-08-04 00:18:12 +03:00
if (!/Format:/.exec(subst)) {
2025-02-28 14:03:43 -05:00
return subst
} else {
try {
return childProcess
.execSync('git rev-parse --short HEAD')
.toString()
.trim()
} catch (e) {
console.error('Failed run git:', e)
return 'UNKNOWN'
}
}
2026-01-06 16:22:52 +02:00
}