<commit_before>#!/bin/sh -l

# This script is licensed under MIT and was originally written by <NAME>. You can find a copy of the MIT license next to this file.
# The original file is available on his Github repo under the following link:
# https://github.com/peter-evans/dockerhub-description/blob/84d38211e27bb9b9effefa718f8c734db8adc5e1/entrypoint.sh

set -euo pipefail
IFS=$'\n\t'

# Set the default path to README.md
README_FILEPATH=${README_FILEPATH:="./README.md"}

# Check the file size
if [ $(wc -c <${README_FILEPATH}) -gt 25000 ]; then
  echo "File size exceeds the maximum allowed 25000 bytes"
  exit 1
fi

# Acquire a token for the Docker Hub API
echo "Acquiring token"
LOGIN_PAYLOAD="{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"<PASSWORD>}\"}"
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d ${LOGIN_PAYLOAD} https://hub.docker.com/v2/users/login/ | jq -r .token)

# Send a PATCH request to update the description of the repository
echo "Sending PATCH request"
REPO_URL="https://hub.docker.com/v2/repositories/${DOCKERHUB_REPOSITORY}/"
RESPONSE_CODE=$(curl -s --write-out %{response_code} --output /dev/null -H "Authorization: JWT ${TOKEN}" -X PATCH --data-urlencode full_description@${README_FILEPATH} ${REPO_URL})
echo "Received response code: $RESPONSE_CODE"

if [ $RESPONSE_CODE -eq 200 ]; then
  exit 0
else
  exit 1
fi<commit_msg>Fix shellcheck warnings, change shebang to bash<commit_after>#!/bin/bash

# This script is licensed under MIT and was originally written by <NAME>. You can find a copy of the MIT license next to this file.
# The original file is available on his Github repo under the following link:
# https://github.com/peter-evans/dockerhub-description/blob/84d38211e27bb9b9effefa718f8c734db8adc5e1/entrypoint.sh

set -euo pipefail
IFS=$'\n\t'

# Set the default path to README.md
README_FILEPATH=${README_FILEPATH:="./README.md"}

# Check the file size
if [[ $(wc -c <${README_FILEPATH}) -gt 25000 ]]; then
  echo "File size exceeds the maximum allowed 25000 bytes"
  exit 1
fi

# Acquire a token for the Docker Hub API
echo "Acquiring token"
# shellcheck disable=2089
LOGIN_PAYLOAD="{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"${<PASSWORD>}\"}"
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d "${LOGIN_PAYLOAD}" https://hub.docker.com/v2/users/login/ | jq -r .token)

# Send a PATCH request to update the description of the repository
echo "Sending PATCH request"
REPO_URL="https://hub.docker.com/v2/repositories/${DOCKERHUB_REPOSITORY}/"
RESPONSE_CODE=$(curl -s --write-out "%{response_code}" --output /dev/null -H "Authorization: JWT ${TOKEN}" -X PATCH --data-urlencode full_description@${README_FILEPATH} "${REPO_URL}")
echo "Received response code: $RESPONSE_CODE"

if [[ $RESPONSE_CODE -eq 200 ]]; then
  exit 0
else
  exit 1
fi
{'fraction_non_alphanumeric': 0.13503004595263343, 'fraction_numerical': 0.028985507246376812, 'mean_word_length': 4.637450199203188, 'pattern_counts': {'":': 4, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 6, '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': '7035912', 'n_tokens_mistral': 1052, 'n_tokens_neox': 991, 'n_words': 306}