platform/common/scripts/check_model_version.js
Denis Bykhov 52df4cc869
Update model version and fix check script (#6218)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
2024-08-01 17:20:20 +07:00

20 lines
688 B
JavaScript
Executable File

const exec = require('child_process').exec
exec('git describe --tags `git rev-list --tags --max-count=1`', (err, stdout, stderr) => {
if (err !== null) {
process.exit(1)
}
const tag = stdout.trim()
exec(`git fetch --tags && git diff ${tag} --name-only`, (err, stdout, stderr) => {
if (err !== null) {
process.exit(1)
}
const changedFiles = stdout.trim().split('\n')
const modelsChanged = changedFiles.some(file => file.startsWith('models/'))
const versionChanged = changedFiles.some(file => file.endsWith('version.txt'))
if (modelsChanged && !versionChanged) {
console.log('Please update model version')
process.exit(1)
}
})
})