Skip to content

Commit a764821

Browse files
authored
Merge pull request #634 from aws-amplify/fix-release-webhook
Codebuild web-hook triggers related fixes
2 parents c6d1152 + bd443f6 commit a764821

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

.codebuild/scripts/lint_pr.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
set -xeo pipefail
22
# extract the PR number from the PR link
33
PR_NUM=${CODEBUILD_WEBHOOK_TRIGGER##*/}
4+
PROJECT_USERNAME=aws-amplify
5+
REPO_NAME=amplify-codegen
46

57
if [ -z "$PR_NUM" ]; then
68
echo "Could not determine PR number. Cannot determine fork point for linting. Skipping linting."

.codebuild/scripts/publish.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash -e
22

3+
if [[ "$CODEBUILD_WEBHOOK_TRIGGER" == "pr/"* ]]; then
4+
BRANCH_NAME=${CODEBUILD_WEBHOOK_BASE_REF##*/}
5+
fi
6+
37
if [ -z "$BRANCH_NAME" ]; then
48
echo "BRANCH_NAME is missing"
59
exit 1

scripts/test-swift-modelgen.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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

2728
function 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

shared-scripts.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)