Skip to content

Commit

Permalink
Update add-tags.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
shestakoven authored Oct 29, 2024
1 parent f088167 commit ca750ec
Showing 1 changed file with 42 additions and 22 deletions.
64 changes: 42 additions & 22 deletions .github/workflows/add-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,46 @@ jobs:
- uses: actions/checkout@v3
- name: update tags
run: |
declare -A directories_and_urls=(
["tokens"]="URL_1 URL_2"
["accounts"]="URL_3 URL_4"
)
# Loop over each directory and its corresponding URLs
for dir in "${!directories_and_urls[@]}"; do
# Merge JSON files in the directory
jq -s 'flatten' "$dir"/*.json > merged.json
# Iterate over URLs and upload the merged file
for url_key in ${directories_and_urls[$dir]}; do
curl -X 'POST' \
"${{ secrets[$url_key] }}" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=application/json'
done
# Remove the merged file after processing
rm merged.json
done
# Define directories and their corresponding URLs explicitly
declare -A directories_and_urls=(
["tokens"]="URL_1 URL_2"
["accounts"]="URL_3 URL_4"
)
# Loop over each directory and its corresponding URLs
for dir in "${!directories_and_urls[@]}"; do
# Merge JSON files in the directory
jq -s 'flatten' "$dir"/*.json > merged.json
# Check directory and upload merged file to the specific URLs
if [[ "$dir" == "tokens" ]]; then
curl -X 'POST' \
"${{ secrets.URL_1 }}" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=application/json'
curl -X 'POST' \
"${{ secrets.URL_2 }}" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=application/json'
elif [[ "$dir" == "accounts" ]]; then
curl -X 'POST' \
"${{ secrets.URL_3 }}" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=application/json'
curl -X 'POST' \
"${{ secrets.URL_4 }}" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected];type=application/json'
fi
# Remove the merged file after processing
rm merged.json
done

0 comments on commit ca750ec

Please sign in to comment.