diff --git a/.codebuild/scripts/lint_pr.sh b/.codebuild/scripts/lint_pr.sh index ce1fbbe79..fcdd133a0 100644 --- a/.codebuild/scripts/lint_pr.sh +++ b/.codebuild/scripts/lint_pr.sh @@ -1,6 +1,8 @@ set -xeo pipefail # extract the PR number from the PR link PR_NUM=${CODEBUILD_WEBHOOK_TRIGGER##*/} +PROJECT_USERNAME=aws-amplify +REPO_NAME=amplify-codegen if [ -z "$PR_NUM" ]; then echo "Could not determine PR number. Cannot determine fork point for linting. Skipping linting." diff --git a/.codebuild/scripts/publish.sh b/.codebuild/scripts/publish.sh index 43a967bd1..2dafcfc2c 100755 --- a/.codebuild/scripts/publish.sh +++ b/.codebuild/scripts/publish.sh @@ -1,5 +1,9 @@ #!/bin/bash -e +if [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then + BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/} +fi + if [ -z "$BRANCH_NAME" ]; then echo "BRANCH_NAME is missing" exit 1 diff --git a/scripts/test-swift-modelgen.sh b/scripts/test-swift-modelgen.sh index 756119189..cc21dca4a 100755 --- a/scripts/test-swift-modelgen.sh +++ b/scripts/test-swift-modelgen.sh @@ -19,19 +19,19 @@ function buildModels() { cd ${tempDirectory}/models for model in */; do + cd ${tempDirectory}/models/$model echo "Building model $model" - buildAndRunModel $model $pathToSwiftPackage + buildAndRunModel $pathToSwiftPackage done } function buildAndRunModel() { - modelName=$1 - pathToSwiftPackage=$2 + pathToSwiftPackage=$1 # copy with replace all model files to the swift package mkdir -p $pathToSwiftPackage/Sources/models rm -rf $pathToSwiftPackage/Sources/models/* - cp -r $modelName/* $pathToSwiftPackage/Sources/models + cp -r ./* $pathToSwiftPackage/Sources/models ls $pathToSwiftPackage/Sources/models # build and run the model diff --git a/shared-scripts.sh b/shared-scripts.sh index 18340af86..f81be8077 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -115,11 +115,16 @@ function _publishToLocalRegistry { echo "Publish To Local Registry" loadCacheFromBuildJob if [ -z "$BRANCH_NAME" ]; then - export BRANCH_NAME="$(git symbolic-ref HEAD --short 2>/dev/null)" - if [ "$BRANCH_NAME" = "" ] ; then - BRANCH_NAME="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')"; + if [ -z "$CODEBUILD_WEBHOOK_TRIGGER" ]; then + export BRANCH_NAME="$(git symbolic-ref HEAD --short 2>/dev/null)" + if [ "$BRANCH_NAME" = "" ] ; then + BRANCH_NAME="$(git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed 's/remotes\/origin\///g')"; + fi + elif [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then + export BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/} fi fi + echo $BRANCH_NAME git checkout $BRANCH_NAME # Fetching git tags from upstream