<commit_before>#!/bin/bash

check () {
  retval=$1
  if [ $retval -ne 0 ]; then
      >&2 echo "Return code was not zero but $retval"
      exit 999
  fi
}

#last commit message:
MESSAGE=$(git log -1 --pretty=%B)
echo Last commit message is "'"$MESSAGE"'"
RELEASE_DIR="$HOME/transempregos-portal-release"
if [ -d "$RELEASE_DIR" ]; then
    echo Deleting release dir "'"$RELEASE_DIR"'"...
    rm -rf "$RELEASE_DIR"
fi
echo Cloning to "'"$RELEASE_DIR"'"...
git clone --depth 1 <EMAIL>:TransEmpregos/transempregos-portal-release.git "$RELEASE_DIR"
check $?
echo Deleting old files...
cd $RELEASE_DIR
find . -path ./.git -prune -o -exec rm -rf {} \; 2> /dev/null
check $?
echo Copying release files from "'"$SNAP_WORKING_DIR"'" to "'"$RELEASE_DIR"'"...
mkdir dist
cp -R "$SNAP_WORKING_DIR/dist/." "$RELEASE_DIR/dist/"
cp "$SNAP_WORKING_DIR/package.json" "$RELEASE_DIR/package.json"
check $?
echo Adding files to git...
git add -A
check $?
echo Committing...
git commit -m "#$SNAP_PIPELINE_COUNTER $MESSAGE

Original commit: $SNAP_COMMIT
On Branch: $SNAP_BRANCH"
check $?
echo Pushing files to git...<commit_msg>Change removal of files in deploy.sh<commit_after>#!/bin/bash

check () {
  retval=$1
  if [ $retval -ne 0 ]; then
      >&2 echo "Return code was not zero but $retval"
      exit 999
  fi
}

#last commit message:
MESSAGE=$(git log -1 --pretty=%B)
echo Last commit message is "'"$MESSAGE"'"
RELEASE_DIR="$HOME/transempregos-portal-release"
if [ -d "$RELEASE_DIR" ]; then
    echo Deleting release dir "'"$RELEASE_DIR"'"...
    rm -rf "$RELEASE_DIR"
fi
echo Cloning to "'"$RELEASE_DIR"'"...
git clone --depth 1 <EMAIL>:TransEmpregos/transempregos-portal-release.git "$RELEASE_DIR"
check $?
echo Deleting old files...
cd $RELEASE_DIR
shopt -s extglob
rm !(.git|.|..) -rf
check $?
echo Copying release files from "'"$SNAP_WORKING_DIR"'" to "'"$RELEASE_DIR"'"...
mkdir dist
cp -R "$SNAP_WORKING_DIR/dist/." "$RELEASE_DIR/dist/"
cp "$SNAP_WORKING_DIR/package.json" "$RELEASE_DIR/package.json"
check $?
echo Adding files to git...
git add -A
check $?
echo Committing...
git commit -m "#$SNAP_PIPELINE_COUNTER $MESSAGE

Original commit: $SNAP_COMMIT
On Branch: $SNAP_BRANCH"
check $?
echo Pushing files to git...
{'fraction_non_alphanumeric': 0.1609403254972875, 'fraction_numerical': 0.0076853526220614825, 'mean_word_length': 3.9618834080717487, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '4166869', 'n_tokens_mistral': 840, 'n_tokens_neox': 801, 'n_words': 242}