@@ -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,24 @@ 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+ echo " ## git rev-parse --show-toplevel: $( git rev-parse --show-toplevel) "
87+ echo " ## ls -la git rev-parse --show-toplevel: $( ls -la $( git rev-parse --show-toplevel) ) "
88+ echo " ## cat go.work: cat $( git rev-parse --show-toplevel) /go.work"
89+ echo " ## pwd: $( pwd) "
90+ echo " ## ls -la pwd: $( ls -la) "
91+ echo " ## cat go.work: cat $( pwd) /go.work"
92+ make lint skip-non-generated-files=true service=$service || {
93+ echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
94+ continue
95+ }
96+ make test skip-non-generated-files=true service=$service || {
97+ echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
98+ continue
99+ }
100+
83101 if [[ " $BRANCH_PREFIX " != " main" ]]; then
84102 git switch main # This is needed to create a new branch for the service without including the previously committed files
85103 branch=" $BRANCH_PREFIX /$service "
@@ -99,25 +117,13 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
99117
100118 if [[ " $branch " != " main" ]]; then
101119 echo " >> Creating PR for $service "
102-
103120 git commit -m " Generate $service "
104121 git push origin " $branch "
105122 gh pr create --title " Generator: Update SDK /services/$service " --body " $COMMIT_INFO " --head " $branch " --base " main"
106123 else
107124 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 "
125+ # git commit -m "Generate $service: $COMMIT_INFO"
126+ # git push origin "$branch"
121127 fi
122128 fi
123129done
0 commit comments