<commit_before>#!/usr/bin/env node
'use strict';

const prompt = require('prompt');
const semver = require('semver');
const mversion = require('mversion');
const path = require('path');
const fs = require('fs');

const shell = require('shelljs');
shell.fatal = true;

const colors = require('colors');
colors.setTheme({
  error: 'red',
  info: 'green'
});

const packageJson = require('../package.json');

shell.echo(`Algoliasearch-Helper release script`);

checkEnvironment();
mergeDevIntoMaster();
showChangelog();
promptVersion(packageJson.version, (version) => {
  bumpVersion(version, () => {
    commitNewFiles(version);
    publish();
    goBackToDevelop();
  });
});

function checkEnvironment() {
  const currentBranch = shell.exec('git rev-parse --abbrev-ref HEAD', {silent: true}).toString();

  if (currentBranch !== 'develop') {
    shell.echo('The release script should be started from develop'.error);
    process.exit(1);
  }

  const changes = shell.exec('git status --porcelain', {silent: true}).toString().trim();

  if (changes.length > 0) {<commit_msg>chore(tool): Correctly detect branch in release.js<commit_after>#!/usr/bin/env node
'use strict';

const prompt = require('prompt');
const semver = require('semver');
const mversion = require('mversion');
const path = require('path');
const fs = require('fs');

const shell = require('shelljs');
shell.fatal = true;

const colors = require('colors');
colors.setTheme({
  error: 'red',
  info: 'green'
});

const packageJson = require('../package.json');

shell.echo(`Algoliasearch-Helper release script`);

checkEnvironment();
mergeDevIntoMaster();
showChangelog();
promptVersion(packageJson.version, (version) => {
  bumpVersion(version, () => {
    commitNewFiles(version);
    publish();
    goBackToDevelop();
  });
});

function checkEnvironment() {
  const currentBranch = shell.exec('git rev-parse --abbrev-ref HEAD', {silent: true}).toString().trim();

  console.log(currentBranch);
  if (currentBranch !== 'develop') {
    shell.echo('The release script should be started from develop'.error);
    process.exit(1);
  }

  const changes = shell.exec('git status --porcelain', {silent: true}).toString().trim();

  if (changes.length > 0) {
{'fraction_non_alphanumeric': 0.17612612612612613, 'fraction_numerical': 0.0018018018018018018, 'mean_word_length': 5.0353260869565215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4848907', 'n_tokens_mistral': 689, 'n_tokens_neox': 672, 'n_words': 164}