From 320729d97beea44f4ad7b67b1d41e391567c109c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Simard?= Date: Wed, 15 May 2024 15:08:13 -0400 Subject: [PATCH] Removed debug code and added comments --- ...aries_to_bucket_and_update_glossaries.yaml | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/upload_csv_glossaries_to_bucket_and_update_glossaries.yaml b/.github/workflows/upload_csv_glossaries_to_bucket_and_update_glossaries.yaml index 9c89c23c3..e62861d9f 100644 --- a/.github/workflows/upload_csv_glossaries_to_bucket_and_update_glossaries.yaml +++ b/.github/workflows/upload_csv_glossaries_to_bucket_and_update_glossaries.yaml @@ -59,35 +59,22 @@ jobs: access_token=$(gcloud auth application-default print-access-token | sed '/^$/q') for file in $GITHUB_WORKSPACE/glossaries-for-google-translate-api/*; do - + + # Extract the necessary data from the filename filename=$(basename "$file") file_sans_ext="${filename%.*}" language_code="${file_sans_ext##*-}" - # Construct the patch_url + # Construct the arguments and JSON payload patch_url="https://translation.googleapis.com/v3/projects/810644617646/locations/us-central1/glossaries/${file_sans_ext}?update_mask=input_config,display_name" gloss_name="projects/810644617646/locations/us-central1/glossaries/${file_sans_ext}" gcs_source_uri="gs://glossaries.mobilitydata.org/$filename" json_data="{ \"name\": \"$gloss_name\", \"inputConfig\": { \"gcsSource\": { \"inputUri\": \"$gcs_source_uri\" } } }" - - # Print the constructed URL for verification - echo "curl_command:" - echo -n "curl -X PATCH \"$patch_url\" \\" - echo " -H \"Authorization: Bearer $access_token\" \\" - echo " -H \"Content-Type: application/json\" \\" - echo " -d '$json_data'" - # execute the curl command after verification + # Execute the curl command curl -X PATCH "$patch_url" \ -H "Authorization: Bearer $access_token" \ -H "Content-Type: application/json" \ -d "$json_data" - - # if [[ $? -eq 0 ]]; then - # echo "Patch successful!" - # else - # echo "Patch failed!" - # echo "Error output: $curl_output" - # fi done