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

set -eu -o pipefail

readonly relativeOutputPath=$1
readonly prNumber=$2
readonly prLastSha=$3
readonly inputDir=../dist/bin/aio/build
readonly outputFile=$PROJECT_ROOT/$relativeOutputPath
readonly deployedUrl=https://pr${prNumber}-${prLastSha:0:7}.ngbuilds.io/

(
  cd $PROJECT_ROOT/aio

  # Build and store the app
  yarn build

  # Set deployedUrl as parameter in the opensearch description
  # deployedUrl must end with /
  yarn set-opensearch-url $deployedUrl

  mkdir -p "`dirname $outputFile`"
  tar --create --gzip --directory "$inputDir" --file "$outputFile" .
)
<commit_msg>build(bazel): fix a bug where the opensearch url coudln't be substituted<commit_after>#!/usr/bin/env bash

set -eu -o pipefail

readonly relativeOutputPath=$1
readonly prNumber=$2
readonly prLastSha=$3
readonly inputDir=../dist/bin/aio/build
readonly outputFile=$PROJECT_ROOT/$relativeOutputPath
readonly deployedUrl=https://pr${prNumber}-${prLastSha:0:7}.ngbuilds.io/

(
  cd $PROJECT_ROOT/aio

  # Build and store the app
  yarn build

  # Remove write protection from the opensearch.xml in the Bazel
  # output tree so that the url can be substituted.
  chmod u+w ../dist/bin/aio/build/assets/opensearch.xml

  # Set deployedUrl as parameter in the opensearch description
  # deployedUrl must end with /
  yarn set-opensearch-url $deployedUrl

  mkdir -p "`dirname $outputFile`"
  tar --create --gzip --directory "$inputDir" --file "$outputFile" .
)

{'fraction_non_alphanumeric': 0.11405295315682282, 'fraction_numerical': 0.006788866259334691, 'mean_word_length': 4.264285714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4014718', 'n_tokens_mistral': 513, 'n_tokens_neox': 480, 'n_words': 137}