Skip to content

Commit

Permalink
Update GetDownloadCount.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
shupershuff authored Sep 12, 2024
1 parent 985239e commit 6f02314
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/GetDownloadCount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,25 @@ jobs:
# Fetch the releases
releases=$(curl -s https://api.github.com/repos/shupershuff/diablo2rloader/releases)
# Directly validate the JSON format
echo "$releases" | jq empty || { echo "Error: Invalid JSON response."; exit 1; }
# Debug: Print raw JSON to check the response
echo "Raw releases data:"
echo "$releases"
# Validate JSON format and check for errors
if ! echo "$releases" | jq empty > /dev/null 2>&1; then
echo "Error: Invalid JSON response."
exit 1
fi
# Initialize variables for max downloads
max_download_count=0
release_with_max_downloads=""
# Iterate through each release using a for loop
echo "$releases" | jq -c '.[]' | while IFS= read -r release; do
release_name=$(echo "$release" | jq -r '.tag_name')
download_count=$(echo "$release" | jq '[.assets[].download_count // 0] | add')
echo "$releases" | jq -c '.[]' | while read -r release; do
release_data=$(echo "$release" | jq '.')
release_name=$(echo "$release_data" | jq -r '.tag_name')
download_count=$(echo "$release_data" | jq '[.assets[].download_count // 0] | add')
# Log the release name and download count for debugging
echo "Release: $release_name, Download Count: $download_count"
Expand Down

0 comments on commit 6f02314

Please sign in to comment.