<commit_before>#!/bin/bash
# shellcheck disable=SC2086
#
# To be utilized in CircleCI
# Determine target branch from PR number and rebase against that

set -e
set -u
set -o pipefail


# Only run this logic on PRs in CI, not on regular branch checks.
if [[ -n "${CIRCLE_PULL_REQUEST:-}" ]]
then
    GITHUB_PR_URL="https://api.github.com/repos/freedomofpress/securedrop/pulls/${CIRCLE_PULL_REQUEST##*/}"

    # If current branch is not main or doesnt start with release...
    if [[ "$CIRCLE_BRANCH" != "main"  && "$CIRCLE_BRANCH" != release*  ]]; then

      # Git will yell at you when trying to rebase without author/email configured
      git config --global user.email "<EMAIL>"
      git config --global user.name "CI User"

      # Ensure presensce of upstream remote
      git ls-remote --exit-code --quiet upstream 2>/dev/null || git remote add upstream https://github.com/freedomofpress/securedrop.git

      # Determine target branch via API
      target_branch="$(curl -s ${GITHUB_PR_URL} | python -c 'import sys, json; print(json.load(sys.stdin)["base"]["ref"])')"

      # Fetch and rebase onto the latest in develop
      git fetch upstream "${target_branch}"
      git rebase "upstream/${target_branch}"

      # Print out the current head for debugging potential CI issues
      git rev-parse HEAD
    fi
fi<commit_msg>removed conditional - the rebase check should be applied on all PRs.<commit_after>#!/bin/bash
# shellcheck disable=SC2086
#
# To be utilized in CircleCI
# Determine target branch from PR number and rebase against that

set -e
set -u
set -o pipefail


# Only run this logic on PRs in CI, not on regular branch checks.
if [[ -n "${CIRCLE_PULL_REQUEST:-}" ]]
then
    GITHUB_PR_URL="https://api.github.com/repos/freedomofpress/securedrop/pulls/${CIRCLE_PULL_REQUEST##*/}"

    # Git will yell at you when trying to rebase without author/email configured
    git config --global user.email "<EMAIL>"
    git config --global user.name "CI User"

    # Ensure presensce of upstream remote
    git ls-remote --exit-code --quiet upstream 2>/dev/null || git remote add upstream https://github.com/freedomofpress/securedrop.git

    # Determine target branch via API
    target_branch="$(curl -s ${GITHUB_PR_URL} | python -c 'import sys, json; print(json.load(sys.stdin)["base"]["ref"])')"

    # Fetch and rebase onto the latest in develop
    git fetch upstream "${target_branch}"
    git rebase "upstream/${target_branch}"

    # Print out the current head for debugging potential CI issues
    git rev-parse HEAD
fi
{'fraction_non_alphanumeric': 0.1108926464805348, 'fraction_numerical': 0.003932363350373574, 'mean_word_length': 3.4946996466431095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5495677', 'n_tokens_mistral': 818, 'n_tokens_neox': 766, 'n_words': 277}