Skip to content

Commit

Permalink
Update GetDownloadCount.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
shupershuff authored Jun 18, 2024
1 parent 9517b1d commit a34147b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/GetDownloadCount.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update Download Count

on:
schedule:
- cron: '0 0 * * *' # Runs every hour
- cron: '0 * * * *' # Runs every hour
workflow_dispatch: # Allows manual triggering

jobs:
Expand All @@ -16,9 +16,7 @@ jobs:
- name: Fetch Release Data
id: fetch_release
run: |
release_data=$(curl -s https://api.github.com/repos/shupershuff/diablo2rloader/releases/latest)
echo "Fetched release data:"
echo "$release_data"
release_data=$(curl -s https://api.github.com/repos/shupershuff/diablo2rloader/releases/latest | jq -c '.')
echo "release_data=$release_data" >> $GITHUB_OUTPUT
- name: Calculate Download Count
Expand All @@ -27,9 +25,9 @@ jobs:
release_data="${{ steps.fetch_release.outputs.release_data }}"
echo "Fetched release data: $release_data"
# Use jq to extract download_count from assets array
download_count=$(echo "$release_data" | jq '.assets[0].download_count')
echo "Download count: $download_count"
download_count=$(echo "$release_data" | jq '[.assets[].download_count] | add')
echo "download_count=$download_count" >> $GITHUB_OUTPUT
# Check if download_count is empty or null
if [ "$download_count" == "null" ] || [ -z "$download_count" ]; then
echo "No download count found, setting to 0"
Expand Down

0 comments on commit a34147b

Please sign in to comment.