Skip to content

Update Leaderboard Table #228

Update Leaderboard Table

Update Leaderboard Table #228

name: Update Leaderboard Table
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update-leaderboard:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install pup
run: |
sudo apt-get update
sudo apt-get install -y unzip curl
curl -sL https://github.com/ericchiang/pup/releases/download/v0.4.0/pup_v0.4.0_linux_amd64.zip -o pup.zip
unzip pup.zip
chmod +x pup
sudo mv pup /usr/local/bin/
- name: Fetch remote leaderboard page
run: wget -qO page.html https://comma.ai/leaderboard
- name: Extract table
run: |
pup 'div#compression_challenge_table table' < page.html > table.html
- name: Splice HTML into both README files
run: |
for file in README.md compression/README.md; do
awk '
/<!-- TABLE-START -->/ { print; system("cat table.html"); skip=1; next }
/<!-- TABLE-END -->/ { skip=0 }
skip==0 { print }
' "$file" > "${file}.updated"
mv "${file}.updated" "$file"
done
- name: Commit & push if changed
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git diff --quiet || (git add README.md compression/README.md && git commit -m "ci: update leaderboard tables" && git push)