<commit_before>import spawnAsync from '@exponent/spawn-async';
import git from 'git-promise';
import rimraf from 'rimraf';

import CI, { Rocker, Kubernetes as K8S, Log, Github } from 'ci';

export default {
  config: {
    name: '📚 Docs',
    shortname: 'docs',
    description: 'Docs Build/Deploy',
    branches: 'master',
    allowPRs: true,
  },
  steps: (branch, tag, pr) => {
    if (tag) {
      // all we need to do when there's a tag is deploy
      return [
        deploy(branch, tag, pr),
        CI.waitStep(),
        updateSearchIndex(branch, tag, pr),
      ];
    }
    const steps = [
      build(branch, tag, pr),
      CI.waitStep(),
      deploy(branch, tag, pr),
    ];
    if (!pr) {
      steps.push(CI.blockStep(':shipit: Deploy to Production?'), tagRelease);
    }
    return steps;
  },
};

const build = (branch, tag, pr) => ({
  name: `:hammer: Build`,
  agents: {
    queue: 'builder',<commit_msg>[docs][www][ci] Don't deploy docs/www to a dev environment for PRs automatically -- put behind block step<commit_after>import spawnAsync from '@exponent/spawn-async';
import git from 'git-promise';
import rimraf from 'rimraf';

import CI, { Rocker, Kubernetes as K8S, Log, Github } from 'ci';

export default {
  config: {
    name: '📚 Docs',
    shortname: 'docs',
    description: 'Docs Build/Deploy',
    branches: 'master',
    allowPRs: true,
  },
  steps: (branch, tag, pr) => {
    if (tag) {
      // all we need to do when there's a tag is deploy
      return [
        deploy(branch, tag, pr),
        CI.waitStep(),
        updateSearchIndex(branch, tag, pr),
      ];
    }
    const steps = [build(branch, tag, pr)];
    if (!pr) {
      steps = [
        ...steps,
        CI.waitStep(),
        deploy(branch, tag, pr),
        CI.blockStep(':shipit: Deploy to Production?'),
        tagRelease,
      ];
    } else {
      steps = [
        ...steps,
        CI.blockStep(':shipit: Deploy to Dev Environment?'),
        deploy(branch, tag, pr),
      ];
    }
    return steps;
  },
};

const build = (branch, tag, pr) => ({
  name: `:hammer: Build`,
  agents: {
    queue: 'builder',
{'fraction_non_alphanumeric': 0.1533396048918156, 'fraction_numerical': 0.0009407337723424271, 'mean_word_length': 2.4306451612903226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3777666', 'n_tokens_mistral': 723, 'n_tokens_neox': 704, 'n_words': 208}