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

# WARNING: CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN should NOT be printed.
set +x -eu -o pipefail

# Do not deploy if we are running in a fork.
if [[ "$CI_REPO_OWNER/$CI_REPO_NAME" != "angular/angular" ]]; then
  echo "Skipping deploy because this is not angular/angular."
  exit 0
fi

# Do not deploy if this is a PR. PRs are deployed in the `aio_preview` CircleCI job.
if [[ $CI_PULL_REQUEST != "false" ]]; then
  echo "Skipping deploy because this is a PR build."
  exit 0
fi

# Do not deploy if the current commit is not the latest on its branch.
readonly latestCommit=$(git ls-remote origin $CI_BRANCH | cut -c1-40)
if [[ $CI_COMMIT != $latestCommit ]]; then
  echo "Skipping deploy because $CI_COMMIT is not the latest commit ($latestCommit)."
  exit 0
fi

# The deployment mode is computed based on the branch we are building
if [[ $CI_BRANCH == master ]]; then
  readonly deployEnv=next
elif [[ $CI_BRANCH == $CI_STABLE_BRANCH ]]; then
  readonly deployEnv=stable
else
  # Extract the major versions from the branches, e.g. the 4 from 4.3.x
  readonly majorVersion=${CI_BRANCH%%.*}
  readonly majorVersionStable=${CI_STABLE_BRANCH%%.*}

  # Do not deploy if the major version is not less than the stable branch major version
  if [[ !( "$majorVersion" < "$majorVersionStable" ) ]]; then
    echo "Skipping deploy of branch \"$CI_BRANCH\" to firebase."
    echo "We only deploy archive branches with the major version less than the stable branch: \"$CI_STABLE_BRANCH\""
    exit 0
  fi

  # Find the branch that has highest minor version for the given `$majorVersion`
  readonly mostRecentMinorVersion=$(
    # List the branches that start with the major version
    git ls-remote origin refs/heads/${majorVersion}.*.x |
    # Extract the version number
    awk -F'/' '{print $3}' |
    # Sort by the minor version<commit_msg>ci(docs-infra): skip deploying RC version when lexicographically smaller than stable (#37426)<commit_after>#!/usr/bin/env bash

# WARNING: CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN should NOT be printed.
set +x -eu -o pipefail

# Do not deploy if we are running in a fork.
if [[ "$CI_REPO_OWNER/$CI_REPO_NAME" != "angular/angular" ]]; then
  echo "Skipping deploy because this is not angular/angular."
  exit 0
fi

# Do not deploy if this is a PR. PRs are deployed in the `aio_preview` CircleCI job.
if [[ $CI_PULL_REQUEST != "false" ]]; then
  echo "Skipping deploy because this is a PR build."
  exit 0
fi

# Do not deploy if the current commit is not the latest on its branch.
readonly latestCommit=$(git ls-remote origin $CI_BRANCH | cut -c1-40)
if [[ $CI_COMMIT != $latestCommit ]]; then
  echo "Skipping deploy because $CI_COMMIT is not the latest commit ($latestCommit)."
  exit 0
fi

# The deployment mode is computed based on the branch we are building
if [[ $CI_BRANCH == master ]]; then
  readonly deployEnv=next
elif [[ $CI_BRANCH == $CI_STABLE_BRANCH ]]; then
  readonly deployEnv=stable
else
  # Extract the major versions from the branches, e.g. the 4 from 4.3.x
  readonly majorVersion=${CI_BRANCH%%.*}
  readonly majorVersionStable=${CI_STABLE_BRANCH%%.*}

  # Do not deploy if the major version is not less than the stable branch major version
  if [[ !( "$majorVersion" -lt "$majorVersionStable" ) ]]; then
    echo "Skipping deploy of branch \"$CI_BRANCH\" to firebase."
    echo "We only deploy archive branches with the major version less than the stable branch: \"$CI_STABLE_BRANCH\""
    exit 0
  fi

  # Find the branch that has highest minor version for the given `$majorVersion`
  readonly mostRecentMinorVersion=$(
    # List the branches that start with the major version
    git ls-remote origin refs/heads/${majorVersion}.*.x |
    # Extract the version number
    awk -F'/' '{print $3}' |
    # Sort by the minor version
{'fraction_non_alphanumeric': 0.0984251968503937, 'fraction_numerical': 0.007086614173228346, 'mean_word_length': 3.9557867360208063, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '2210176', 'n_tokens_mistral': 1221, 'n_tokens_neox': 1190, 'n_words': 484}