From f5c1f138bbbdce42ab7cf12930511cba4ae65526 Mon Sep 17 00:00:00 2001 From: phani-srikar Date: Mon, 17 Jul 2023 12:43:22 -0700 Subject: [PATCH 1/3] fix: lint and deploy jobs running via a webhook trigger --- .codebuild/scripts/lint_pr.sh | 2 ++ .codebuild/scripts/publish.sh | 4 ++++ 2 files changed, 6 insertions(+) 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 From 33b28f8ebaee6705bee7bc4d7e96eb41172dd5d9 Mon Sep 17 00:00:00 2001 From: phani-srikar Date: Mon, 17 Jul 2023 13:07:14 -0700 Subject: [PATCH 2/3] fix: e2e webhook call on main branch --- shared-scripts.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 From bd443f669f747de61c03f31f5051eac7f74437b2 Mon Sep 17 00:00:00 2001 From: phani-srikar Date: Mon, 17 Jul 2023 14:16:32 -0700 Subject: [PATCH 3/3] chore: fix the relative path issue ios github workflow --- scripts/test-swift-modelgen.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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