@@ -11,19 +11,19 @@ BRANCH_PREFIX=$1
1111COMMIT_INFO=$2
1212
1313if [ $# -lt 2 ]; then
14- echo " Not enough arguments supplied. Required: 'branch-prefix' 'commit-info'"
14+ echo " ! Not enough arguments supplied. Required: 'branch-prefix' 'commit-info'"
1515 exit 1
1616fi
1717
1818if type -p go > /dev/null; then
1919 :
2020else
21- echo " Go not installed, unable to proceed."
21+ echo " ! Go not installed, unable to proceed."
2222 exit 1
2323fi
2424
2525if [ ! -d ${SDK_REPO_LOCAL_PATH} ]; then
26- echo " sdk to commit not found in root. Please run make generate-sdk"
26+ echo " ! SDK to commit not found in root. Please run make generate-sdk"
2727 exit 1
2828fi
2929
4141fi
4242
4343# Create temp directory to work on
44- work_dir=$( mktemp -d)
44+ work_dir=" $ROOT_DIR /temp"
45+ mkdir -p ${work_dir}
4546if [[ ! ${work_dir} || -d {work_dir} ]]; then
4647 echo " Unable to create temporary directory"
4748 exit 1
@@ -60,7 +61,7 @@ rm -rf ${work_dir}/sdk_to_push/.git
6061
6162# Initialize git repo
6263cd ${work_dir} /git_repo
63- git clone ${REPO_URL_SSH} ./
64+ git clone ${REPO_URL_SSH} ./ --quiet
6465git config user.name " ${COMMIT_NAME} "
6566git config user.email " ${COMMIT_EMAIL} "
6667
@@ -80,6 +81,18 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
8081 service_changes=$( git status --porcelain " services/$service " )
8182
8283 if [[ -n " $service_changes " ]]; then
84+ echo -e " \n>> Detected changes in $service service"
85+
86+ # If lint or test fails for a service, we skip it and continue to the next one
87+ make lint skip-non-generated-files=true service=$service || {
88+ echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
89+ continue
90+ }
91+ make test skip-non-generated-files=true service=$service || {
92+ echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
93+ continue
94+ }
95+
8396 if [[ " $BRANCH_PREFIX " != " main" ]]; then
8497 git switch main # This is needed to create a new branch for the service without including the previously committed files
8598 branch=" $BRANCH_PREFIX /$service "
@@ -99,25 +112,13 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
99112
100113 if [[ " $branch " != " main" ]]; then
101114 echo " >> Creating PR for $service "
102-
103115 git commit -m " Generate $service "
104116 git push origin " $branch "
105117 gh pr create --title " Generator: Update SDK /services/$service " --body " $COMMIT_INFO " --head " $branch " --base " main"
106118 else
107119 echo " >> Pushing changes for $service service..."
108-
109- # If lint or test fails for a service, we skip it and continue to the next one
110- make lint skip-non-generated-files=true service=$service || {
111- echo " ! Linting failed for $service "
112- continue
113- }
114- make test skip-non-generated-files=true service=$service || {
115- echo " ! Testing failed for $service "
116- continue
117- }
118-
119- git commit -m " Generate $service : $COMMIT_INFO "
120- git push origin " $branch "
120+ # git commit -m "Generate $service: $COMMIT_INFO"
121+ # git push origin "$branch"
121122 fi
122123 fi
123124done
0 commit comments