@@ -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
@@ -48,7 +48,7 @@ if [[ ! ${work_dir} || -d {work_dir} ]]; then
4848fi
4949
5050# Delete temp directory on exit
51- trap " rm -rf ${work_dir} " EXIT
51+ # trap "rm -rf ${work_dir}" EXIT
5252
5353mkdir ${work_dir} /git_repo # Where the git repo will be created
5454mkdir ${work_dir} /sdk_backup # Backup of the SDK to check for new modules
@@ -60,7 +60,7 @@ rm -rf ${work_dir}/sdk_to_push/.git
6060
6161# Initialize git repo
6262cd ${work_dir} /git_repo
63- git clone ${REPO_URL_SSH} ./
63+ git clone ${REPO_URL_SSH} ./ --quiet
6464git config user.name " ${COMMIT_NAME} "
6565git config user.email " ${COMMIT_EMAIL} "
6666
@@ -80,6 +80,21 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
8080 service_changes=$( git status --porcelain " services/$service " )
8181
8282 if [[ -n " $service_changes " ]]; then
83+ echo -e " \n>> Detected changes in $service service"
84+
85+ # If lint or test fails for a service, we skip it and continue to the next one
86+ cd ${work_dir} /sdk_to_push
87+ echo " ## ls -la sdk_to_push: $( ls -la) "
88+ make lint skip-non-generated-files=true service=$service || {
89+ echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
90+ continue
91+ }
92+ make test skip-non-generated-files=true service=$service || {
93+ echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
94+ continue
95+ }
96+ cd ${work_dir} /git_repo
97+
8398 if [[ " $BRANCH_PREFIX " != " main" ]]; then
8499 git switch main # This is needed to create a new branch for the service without including the previously committed files
85100 branch=" $BRANCH_PREFIX /$service "
@@ -99,25 +114,13 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
99114
100115 if [[ " $branch " != " main" ]]; then
101116 echo " >> Creating PR for $service "
102-
103117 git commit -m " Generate $service "
104118 git push origin " $branch "
105119 gh pr create --title " Generator: Update SDK /services/$service " --body " $COMMIT_INFO " --head " $branch " --base " main"
106120 else
107121 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 "
122+ # git commit -m "Generate $service: $COMMIT_INFO"
123+ # git push origin "$branch"
121124 fi
122125 fi
123126done
0 commit comments