Skip to content

Get Daily counts

Get Daily counts #135

name: Get Daily counts
on:
push:
schedule:
- cron: '0 0 * * *'
jobs:
get_count:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get count
run: |
set -e
OSX_DOWNLOADS=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/risingwavelabs/homebrew-risingwave/releases \
| grep "download_count" \
| awk '{print $2}' \
| sed 's/,//g' \
| paste -sd+ - | bc)
echo "OSX Downloads: $OSX_DOWNLOADS"
LINUX_DOWNLOADS=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/risingwavelabs/risingwave/releases \
| grep "download_count" \
| awk '{print $2}' \
| sed 's/,//g' \
| paste -sd+ - | bc)
echo "Linux Downloads: $LINUX_DOWNLOADS"
DATE=$(date +'%Y-%m-%d')
echo "Date: $DATE"
git config --global user.email "noelkwan@risingwave-labs.com"
git config --global user.name "Noel Kwan"
cp update_data.py update_data.tmp.py
git fetch origin data
git checkout data
./update_data.tmp.py $DATE $OSX_DOWNLOADS $LINUX_DOWNLOADS
git add counts.json
git commit -m "Update counts for $DATE" --allow-empty
git push -f
git checkout -
echo "Done"