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 483c6ab commit 3baac2f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/GetDownloadCount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,23 @@ jobs:
- name: Fetch Download Count
id: fetch_downloads
run: |
# Fetch the releases
releases=$(curl -s https://api.github.com/repos/shupershuff/diablo2rloader/releases)
# Debug: Print releases to check the response
#echo "Releases data: $releases"
echo "Releases data: $releases" > releases.json
# Check if releases is empty or not valid JSON
if [ -z "$releases" ] || ! echo "$releases" | jq empty; then
echo "Error: No releases found or invalid JSON response."
# Validate JSON format and check for errors
if ! jq empty releases.json > /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 to avoid subshell issues
# Iterate through each release using a for loop
for release in $(echo "$releases" | jq -c '.[]'); do
release_data=$(echo "$release" | jq '.')
release_name=$(echo "$release_data" | jq -r '.tag_name')
Expand All @@ -57,6 +58,8 @@ jobs:
echo "download_count=$max_download_count" >> $GITHUB_OUTPUT
echo "release_with_max_downloads=$release_with_max_downloads" >> $GITHUB_OUTPUT
- name: Update JSON File
run: |
echo '{
Expand Down

0 comments on commit 3baac2f

Please sign in to comment.