4141fi
4242
4343# Create temp directory to work on
44- work_dir=$( mktemp -d)
44+ # work_dir=$(mktemp -d)
45+ work_dir=" temp-dir" # TODO: For testing only
46+ mkdir -p ${work_dir} # TODO: For testing only
4547if [[ ! ${work_dir} || -d {work_dir} ]]; then
4648 echo " Unable to create temporary directory"
4749 exit 1
4850fi
4951
5052# Delete temp directory on exit
51- trap " rm -rf ${work_dir} " EXIT
53+ # trap "rm -rf ${work_dir}" EXIT
5254
5355mkdir ${work_dir} /git_repo # Where the git repo will be created
5456mkdir ${work_dir} /sdk_backup # Backup of the SDK to check for new modules
@@ -60,7 +62,7 @@ rm -rf ${work_dir}/sdk_to_push/.git
6062
6163# Initialize git repo
6264cd ${work_dir} /git_repo
63- git clone ${REPO_URL_SSH} ./
65+ git clone ${REPO_URL_SSH} ./ --quiet
6466git config user.name " ${COMMIT_NAME} "
6567git config user.email " ${COMMIT_EMAIL} "
6668
@@ -89,13 +91,12 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
8991 fi
9092
9193 git add services/${service} /
92- if [ " ${LANGUAGE} " == " go" ] && [ ! -d " ${work_dir} /sdk_backup/services/${service} /" ]; then # Check if it is a newly added SDK module
93- # go work use -r adds a use directive to the go.work file for dir, if it exists, and removes the use directory if the argument directory doesn’t exist
94- # the -r flag examines subdirectories of dir recursively
95- # this prevents errors if there is more than one new module in the SDK generation
96- go work use -r .
97- git add go.work
98- fi
94+
95+ # go work use -r adds a use directive to the go.work file for dir, if it exists, and removes the use directory if the argument directory doesn’t exist
96+ # The -r flag examines subdirectories of dir recursively
97+ # This prevents errors if there is more than one new module in the SDK generation
98+ go work use -r services
99+ git add go.work
99100
100101 if [[ " $branch " != " main" ]]; then
101102 echo " >> Creating PR for $service "
@@ -108,16 +109,20 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
108109
109110 # If lint or test fails for a service, we skip it and continue to the next one
110111 make lint skip-non-generated-files=true service=$service || {
111- echo " ! Linting failed for $service "
112+ echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED. "
112113 continue
113114 }
115+
116+ echo " >> Adding $service to go.work..."
117+ go work use -r services/$service
114118 make test skip-non-generated-files=true service=$service || {
115- echo " ! Testing failed for $service "
119+ echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED. "
116120 continue
117121 }
118122
119- git commit -m " Generate $service : $COMMIT_INFO "
120- git push origin " $branch "
123+ echo " >> Actually pushing changes to main for $service service..."
124+ # git commit -m "Generate $service: $COMMIT_INFO"
125+ # git push origin "$branch"
121126 fi
122127 fi
123128done
0 commit comments