pleroma-fe/build/commit_hash.js

20 lines
460 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
2026-08-05 19:40:46 +03:00
.execSync(
'PATH=/usr/bin:/bin:/usr/local/bin:/sbin:/usr/sbin git rev-parse --short HEAD',
)
2025-02-28 14:03:43 -05:00
.toString()
.trim()
} catch (e) {
console.error('Failed run git:', e)
return 'UNKNOWN'
}
}
2026-01-06 16:22:52 +02:00
}