const { exec } = require('child_process'); const util = require('util'); const execPromise = util.promisify(exec); async function checkMainBranch() { try { const { stdout, stderr } = await execPromise('git rev-parse --abbrev-ref HEAD'); if (stderr) { console.error(stderr); process.exit(1); } const currentBranch = stdout.trim(); console.log(`Текущая ветка - ${currentBranch}`) if (currentBranch === 'main') { process.exit(0); } else { console.error(`Невозможен релиз не из ветки main`); process.exit(1); } } catch (error) { console.error(`Ошибка выполнения команды: ${error.message}`); process.exit(1); } } checkMainBranch()