Skip to content

Commit

Permalink
Removed debug code and added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericsimard authored May 15, 2024
1 parent 0510aea commit 320729d
Showing 1 changed file with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 320729d

Please sign in to comment.