ci(aio): fix aio payload script

This commit is contained in:
Yuan Gao 2017-06-30 10:08:33 -07:00 committed by Miško Hevery
parent 54e0244954
commit 15a3e2d307
1 changed files with 12 additions and 15 deletions

View File

@ -4,12 +4,8 @@ set -eu -o pipefail
readonly thisDir=$(cd $(dirname $0); pwd) readonly thisDir=$(cd $(dirname $0); pwd)
readonly parentDir=$(dirname $thisDir) readonly parentDir=$(dirname $thisDir)
readonly TOKEN=${ANGULAR_PAYLOAD_FIREBASE_TOKEN:-}
readonly PROJECT_NAME="angular-payload-size" readonly PROJECT_NAME="angular-payload-size"
# temporarily turn on debugging - we disable it later in the script to prevent token leak
set -x
source ${thisDir}/_payload-limits.sh source ${thisDir}/_payload-limits.sh
failed=false failed=false
@ -45,20 +41,21 @@ timestamp=$(date +%s)
payloadData="$payloadData\"timestamp\": $timestamp, " payloadData="$payloadData\"timestamp\": $timestamp, "
# Add change source: application, dependencies, or 'application+dependencies' # Add change source: application, dependencies, or 'application+dependencies'
yarnChanged=false applicationChanged=false
allChangedFiles=$(git diff --name-only $TRAVIS_COMMIT_RANGE $parentDir | wc -l) dependenciesChanged=false
allChangedFileNames=$(git diff --name-only $TRAVIS_COMMIT_RANGE $parentDir) if [[ $(git diff --name-only $TRAVIS_COMMIT_RANGE $parentDir | grep -v aio/yarn.lock | grep -v content) ]]; then
applicationChanged=true
if [[ $allChangedFileNames == *"yarn.lock"* ]]; then fi
yarnChanged=true if [[ $(git diff --name-only $TRAVIS_COMMIT_RANGE $parentDir/yarn.lock) ]]; then
dependenciesChanged=true
fi fi
if [[ $allChangedFiles -eq 1 ]] && [[ "$yarnChanged" = true ]]; then if $dependenciesChanged && $applicationChanged; then
change='application+dependencies'
elif $dependenciesChanged; then
# only yarn.lock changed # only yarn.lock changed
change='dependencies' change='dependencies'
elif [[ $allChangedFiles -gt 1 ]] && [[ "$yarnChanged" = true ]]; then elif $applicationChanged; then
change='application+dependencies'
elif [[ $allChangedFiles -gt 0 ]]; then
change='application' change='application'
else else
# Nothing changed in aio/ # Nothing changed in aio/
@ -76,7 +73,7 @@ if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
# WARNING: FIREBASE_TOKEN should NOT be printed. # WARNING: FIREBASE_TOKEN should NOT be printed.
set +x set +x
firebase database:update --data "$payloadData" --project $PROJECT_NAME --confirm --token "$TOKEN" $dbPath firebase database:update --data "$payloadData" --project $PROJECT_NAME --confirm --token "$ANGULAR_PAYLOAD_FIREBASE_TOKEN" $dbPath
fi fi
if [[ $failed = true ]]; then if [[ $failed = true ]]; then