Skip to content

Update Popularity

Update Popularity #41

name: Update Popularity
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 5'
jobs:
scheduled:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- name: Check out this repo
uses: actions/checkout@v2
with:
ref: 'automated'
fetch-depth: 0
- name: Get deps
run: go install github.com/ericchiang/pup@latest
- name: Fetch and parse latest data
run: |-
curl -s "https://library.vcvrack.com/questionablemodules" | pup ':contains("Popularity: ") text{}' | sed -r 's/ Popularity: //g' | tr -d " \t\n\r" > popularity
pop=$(cat popularity)
sed -i "s/\"[0-9]*,[0-9]*\",/\"$pop\",/g" popularity.json
- name: Commit and push if the data has changed
run: |-
git config user.name "Automated"
git config user.email "actions@users.noreply.github.com"
git remote set-head origin automated
git reset --soft automated~1
git add -A
timestamp=$(date -u)
git commit -m "Updated library analytics (${timestamp})" || exit 0
git push -f origin automated