<commit_before>#!/bin/bash
export PATH="/usr/local/bin:/srv/builder/bin:$PATH"
NAME=$1
BRANCH=$2
EMAIL_ERROR=$3
# keep remote last, since that's a optional argument
REMOTE=$4

if [ -f ~/lock_${NAME} ]; then
    exit 0
fi

date > ~/lock_${NAME}

DIR="/srv/builder/$NAME"
cd $DIR
git fetch -q

if [ $( git diff --name-only origin/${BRANCH:-master} | wc -l ) -eq 0 -a ! -f ~/git_updated_${NAME} ]; then
  rm -f ~/lock_${NAME}
  exit 0
fi

touch  ~/git_updated_${NAME}
git pull --rebase
bundle install
bundle exec middleman build > ~/error_${NAME} 2>&1

if [ $? -ne 0 ]; then
    if [ -n "$MAIL" ]; then<commit_msg>Also update submodule when there is a difference<commit_after>#!/bin/bash
export PATH="/usr/local/bin:/srv/builder/bin:$PATH"
NAME=$1
BRANCH=$2
EMAIL_ERROR=$3
# keep remote last, since that's a optional argument
REMOTE=$4

if [ -f ~/lock_${NAME} ]; then
    exit 0
fi

date > ~/lock_${NAME}

DIR="/srv/builder/$NAME"
cd $DIR
git fetch -q

if [ $( git diff --name-only origin/${BRANCH:-master} | wc -l ) -eq 0 -a ! -f ~/git_updated_${NAME} ]; then
  rm -f ~/lock_${NAME}
  exit 0
fi

touch  ~/git_updated_${NAME}
git pull --rebase
git submodule update
bundle install
bundle exec middleman build > ~/error_${NAME} 2>&1

if [ $? -ne 0 ]; then
    if [ -n "$MAIL" ]; then
{'fraction_non_alphanumeric': 0.1784037558685446, 'fraction_numerical': 0.01564945226917058, 'mean_word_length': 3.487719298245614, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4514379', 'n_tokens_mistral': 523, 'n_tokens_neox': 497, 'n_words': 149}