File tree Expand file tree Collapse file tree 4 files changed +18
-7
lines changed
Expand file tree Collapse file tree 4 files changed +18
-7
lines changed Original file line number Diff line number Diff line change 11set -xeo pipefail
22# extract the PR number from the PR link
33PR_NUM=${CODEBUILD_WEBHOOK_TRIGGER##*/ }
4+ PROJECT_USERNAME=aws-amplify
5+ REPO_NAME=amplify-codegen
46
57if [ -z " $PR_NUM " ]; then
68 echo " Could not determine PR number. Cannot determine fork point for linting. Skipping linting."
Original file line number Diff line number Diff line change 11#! /bin/bash -e
22
3+ if [[ " $CODEBUILD_WEBHOOK_TRIGGER " == " pr/" * ]]; then
4+ BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/ }
5+ fi
6+
37if [ -z " $BRANCH_NAME " ]; then
48 echo " BRANCH_NAME is missing"
59 exit 1
Original file line number Diff line number Diff line change @@ -19,19 +19,19 @@ function buildModels() {
1919
2020 cd ${tempDirectory} /models
2121 for model in * /; do
22+ cd ${tempDirectory} /models/$model
2223 echo " Building model $model "
23- buildAndRunModel $model $ pathToSwiftPackage
24+ buildAndRunModel $pathToSwiftPackage
2425 done
2526}
2627
2728function buildAndRunModel() {
28- modelName=$1
29- pathToSwiftPackage=$2
29+ pathToSwiftPackage=$1
3030
3131 # copy with replace all model files to the swift package
3232 mkdir -p $pathToSwiftPackage /Sources/models
3333 rm -rf $pathToSwiftPackage /Sources/models/*
34- cp -r $modelName /* $pathToSwiftPackage /Sources/models
34+ cp -r . /* $pathToSwiftPackage /Sources/models
3535 ls $pathToSwiftPackage /Sources/models
3636
3737 # build and run the model
Original file line number Diff line number Diff line change @@ -115,11 +115,16 @@ function _publishToLocalRegistry {
115115 echo " Publish To Local Registry"
116116 loadCacheFromBuildJob
117117 if [ -z " $BRANCH_NAME " ]; then
118- export BRANCH_NAME=" $( git symbolic-ref HEAD --short 2> /dev/null) "
119- if [ " $BRANCH_NAME " = " " ] ; then
120- BRANCH_NAME=" $( git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed ' s/remotes\/origin\///g' ) " ;
118+ if [ -z " $CODEBUILD_WEBHOOK_TRIGGER " ]; then
119+ export BRANCH_NAME=" $( git symbolic-ref HEAD --short 2> /dev/null) "
120+ if [ " $BRANCH_NAME " = " " ] ; then
121+ BRANCH_NAME=" $( git rev-parse HEAD | xargs git name-rev | cut -d' ' -f2 | sed ' s/remotes\/origin\///g' ) " ;
122+ fi
123+ elif [[ " $CODEBUILD_WEBHOOK_TRIGGER " == " pr/" * ]]; then
124+ export BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/ }
121125 fi
122126 fi
127+ echo $BRANCH_NAME
123128 git checkout $BRANCH_NAME
124129
125130 # Fetching git tags from upstream
You can’t perform that action at this time.
0 commit comments