owobot/util/version.js

21 lines
488 B
JavaScript
Raw Normal View History

2024-08-12 05:13:32 -04:00
const version = require('../version.json')
const cp = require('child_process')
let botVersion = version.botVersion
let gitCommit
let gitBranch
try {
gitCommit = cp.execSync('git rev-parse --short HEAD').toString('UTF-8').split('\n')[0]
gitBranch = cp.execSync('git rev-parse --abbrev-ref HEAD').toString('UTF-8').split('\n')[0]
} catch (e) {
gitCommit = false
gitBranch = false
}
if (gitCommit) {
botVersion += ` (${gitCommit} - ${gitBranch})`
}
module.exports = botVersion