<commit_before>#!/usr/bin/env sh

set -e

# Installing additional deps:
apk add --no-cache curl jq

# https://gist.github.com/Jaskaranbir/d5b065173b3a6f164e47a542472168c1
USER="$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f1)"
PROJECT="$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f2)"

LAST_RELEASE_TAG=$(curl \
    --header "authorization: Bearer $GITHUB_TOKEN" \
    --url "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" \
  | jq .tag_name | sed 's/"//g'
)
echo "LAST_RELEASE_TAG=$LAST_RELEASE_TAG"
if [ "$LAST_RELEASE_TAG" = 'null' ]; then
  # Most likely, we are facing rate-limiting problems,
  # just try again later.
  exit 1
fi

NEW_CHANGELOG='CHANGELOG-RELEASE.md'

# Generate new CHANGELOG.md with just the last changes
github_changelog_generator \
  --user "$USER" \
  --project "$PROJECT" \
  --token "$GITHUB_OAUTH_TOKEN" \
  --since-tag "$LAST_RELEASE_TAG" \
  --token "$GITHUB_TOKEN" \
  --output "$NEW_CHANGELOG"

echo 'Done! Changelog:'
cat "$NEW_CHANGELOG"<commit_msg>Version 0.4.0 release<commit_after>#!/usr/bin/env sh

set -e

# Installing additional deps:
apk add --no-cache curl jq

# https://gist.github.com/Jaskaranbir/d5b065173b3a6f164e47a542472168c1
USER="$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f1)"
PROJECT="$(echo "$GITHUB_REPOSITORY" | cut -d "/" -f2)"

LAST_RELEASE_TAG=$(curl \
    --header "authorization: Bearer $GITHUB_TOKEN" \
    --url "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" \
  | jq .tag_name | sed 's/"//g'
)
echo "LAST_RELEASE_TAG=$LAST_RELEASE_TAG"
if [ "$LAST_RELEASE_TAG" = 'null' ]; then
  # Most likely, we are facing rate-limiting problems,
  # just try again later.
  exit 1
fi

NEW_CHANGELOG='CHANGELOG-RELEASE.md'

# Generate new CHANGELOG.md with just the last changes
github_changelog_generator \
  --user "$USER" \
  --project "$PROJECT" \
  --token "$GITHUB_OAUTH_TOKEN" \
  --since-tag "$LAST_RELEASE_TAG" \
  --max-issues 450 \
  --no-issues \
  --release-branch 'master' \
  --token "$GITHUB_TOKEN" \
  --output "$NEW_CHANGELOG"

echo 'Done! Changelog:'
cat "$NEW_CHANGELOG"
{'fraction_non_alphanumeric': 0.16015436565364208, 'fraction_numerical': 0.02894356005788712, 'mean_word_length': 3.7898383371824482, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '7291814', 'n_tokens_mistral': 866, 'n_tokens_neox': 827, 'n_words': 168}