<commit_before>#!/bin/sh

set -eu -o pipefail

TAG_PREFIX="${1}"
AWS_ACCOUNT="${2}"
DEPLOY_ENV="${3}"
TAG_FILTER="${4:-""}"

GIT_PUSH="${GIT_PUSH:-true}" # Push the repo at the end or not

GIT_EMAIL="<EMAIL>"
GIT_USER="gov-paas-${AWS_ACCOUNT}"
GIT_REPO_URL="<EMAIL>:alphagov/paas-cf.git"

echo Configure SSH
tar xzf git-keys/git-keys.tar.gz
mkdir -p ~/.ssh

cat <<EOF > ~/.ssh/config
Host github.com
  StrictHostKeyChecking no
  IdentityFile $(pwd)/git-key
EOF

check_already_tagged() {
  tag_prefix="${1}"
  previous_tags="$(git tag -l --contains HEAD "${tag_prefix}*")"
  if [ -n "${previous_tags}" ] ; then
    echo "WARNING: already tagged to current commit for environment ${DEPLOY_ENV}. Skipping."
    echo "Tags: ${previous_tags}"
    exit 0
  fi
}

get_tag(){
  tag_filter="${1}"
  git tag -l --points-at HEAD --sort=version:refname "${tag_filter}" | tail -n 1
}
<commit_msg>Use points-at to list existing tags for HEAD<commit_after>#!/bin/sh

set -eu -o pipefail

TAG_PREFIX="${1}"
AWS_ACCOUNT="${2}"
DEPLOY_ENV="${3}"
TAG_FILTER="${4:-""}"

GIT_PUSH="${GIT_PUSH:-true}" # Push the repo at the end or not

GIT_EMAIL="<EMAIL>"
GIT_USER="gov-paas-${AWS_ACCOUNT}"
GIT_REPO_URL="<EMAIL>:alphagov/paas-cf.git"

echo Configure SSH
tar xzf git-keys/git-keys.tar.gz
mkdir -p ~/.ssh

cat <<EOF > ~/.ssh/config
Host github.<EMAIL>
  StrictHostKeyChecking no
  IdentityFile $(pwd)/git-key
EOF

check_already_tagged() {
  tag_prefix="${1}"
  previous_tags="$(git tag -l --points-at HEAD "${tag_prefix}*")"
  if [ -n "${previous_tags}" ] ; then
    echo "WARNING: already tagged to current commit for environment ${DEPLOY_ENV}. Skipping."
    echo "Tags: ${previous_tags}"
    exit 0
  fi
}

get_tag(){
  tag_filter="${1}"
  git tag -l --points-at HEAD --sort=version:refname "${tag_filter}" | tail -n 1
}

{'fraction_non_alphanumeric': 0.18312985571587126, 'fraction_numerical': 0.008879023307436182, 'mean_word_length': 4.334319526627219, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 10, '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': '5373460', 'n_tokens_mistral': 735, 'n_tokens_neox': 701, 'n_words': 169}