<commit_before>'use strict';

require(`shelljs/global`);

const GIT_USER = process.env.GIT_USER;
const DEPLOY_USER = process.env.DEPLOY_USER;
const CIRCLE_PROJECT_USERNAME = process.env.CIRCLE_PROJECT_USERNAME;
const CIRCLE_PROJECT_REPONAME = process.env.CIRCLE_PROJECT_REPONAME;
const remoteBranch = `https://${GIT_USER}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git`;

if (!which(`git`)) {
  echo(`Sorry, this script requires git`);
  exit(1);
}

// Clear out existing build folder
rm(`-rf`, `build`);
mkdir(`-p`, `build`);

// Build site here
cd(`build`)

if (exec(`git clone ${remoteBranch} ${CIRCLE_PROJECT_REPONAME}-gh-pages`).code !== 0) {
  echo(`Error: Git clone failed`);
  exit(1);
}

cd(`${CIRCLE_PROJECT_REPONAME}-gh-pages`);

if (exec(`git checkout origin/gh-pages`).code +
    exec(`git checkout -b gh-pages`).code +
    exec(`git branch --set-upstream-to=origin/gh-pages`).code !== 0
    ) {
  echo(`Error: Git checkout gh-pages failed`);
  exit(1);
}

cd(`../..`)

if (exec(`node server/generate.js`).code) {
  echo(`Error: generate failed`);
  exit(1);
}

cp(`-R`, `build/${CIRCLE_PROJECT_REPONAME}/*`, `build/${CIRCLE_PROJECT_REPONAME}-gh-pages/`);
cd(`build/${CIRCLE_PROJECT_REPONAME}-gh-pages`)

exec(`git add --all`);
exec(`git commit -m "update website"`)
exec(`git push -f https://${GIT_USER}@github.com/${DEPLOY_USER}/${CIRCLE_PROJECT_REPONAME}.git gh-pages`)
cd(`../..`);

echo(`Website is live at: https://${CIRCLE_PROJECT_USERNAME}.github.io/${CIRCLE_PROJECT_REPONAME}/`)<commit_msg>Do not force push to gh-pages, a protected branch (#2236)<commit_after>'use strict';

require(`shelljs/global`);

const GIT_USER = process.env.GIT_USER;
const DEPLOY_USER = process.env.DEPLOY_USER;
const CIRCLE_PROJECT_USERNAME = process.env.CIRCLE_PROJECT_USERNAME;
const CIRCLE_PROJECT_REPONAME = process.env.CIRCLE_PROJECT_REPONAME;
const remoteBranch = `https://${GIT_USER}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git`;

if (!which(`git`)) {
  echo(`Sorry, this script requires git`);
  exit(1);
}

// Clear out existing build folder
rm(`-rf`, `build`);
mkdir(`-p`, `build`);

// Build site here
cd(`build`)

if (exec(`git clone ${remoteBranch} ${CIRCLE_PROJECT_REPONAME}-gh-pages`).code !== 0) {
  echo(`Error: Git clone failed`);
  exit(1);
}

cd(`${CIRCLE_PROJECT_REPONAME}-gh-pages`);

if (exec(`git checkout origin/gh-pages`).code +
    exec(`git checkout -b gh-pages`).code +
    exec(`git branch --set-upstream-to=origin/gh-pages`).code !== 0
    ) {
  echo(`Error: Git checkout gh-pages failed`);
  exit(1);
}

cd(`../..`)

if (exec(`node server/generate.js`).code) {
  echo(`Error: generate failed`);
  exit(1);
}

cp(`-R`, `build/${CIRCLE_PROJECT_REPONAME}/*`, `build/${CIRCLE_PROJECT_REPONAME}-gh-pages/`);
cd(`build/${CIRCLE_PROJECT_REPONAME}-gh-pages`)

exec(`git add --all`);
exec(`git commit -m "update website"`)
exec(`git push origin gh-pages`)
cd(`../..`);

echo(`Website is live at: https://${CIRCLE_PROJECT_USERNAME}.github.io/${CIRCLE_PROJECT_REPONAME}/`)
{'fraction_non_alphanumeric': 0.1971043106284962, 'fraction_numerical': 0.0052648897663705166, 'mean_word_length': 5.2939958592132506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '787653', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1199, 'n_words': 207}