Skip to content

Update Leaderboard #177

Update Leaderboard

Update Leaderboard #177

# Leaderboard Updater
#
# Fetches recent faucet claims from Basescan and updates the leaderboard.
# Runs every 6 hours and on push to keep data fresh.
name: Update Leaderboard
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
push:
branches: [master]
paths:
- '.github/workflows/update-leaderboard.yml'
- 'scripts/update-leaderboard.js'
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Fetch claims and update leaderboard
env:
FAUCET_ADDRESS: '0x72cd70d28284dD215257f73e1C5aD8e28847215B'
run: node scripts/update-leaderboard.js
- name: Push to data branch
run: |
git config user.name github-actions
git config user.email github-actions@github.com
cp examples/leaderboard/claims.json /tmp/claims.json
git fetch origin data 2>/dev/null
if git rev-parse origin/data >/dev/null 2>&1; then
git checkout -f -B data origin/data
else
git checkout --orphan data
git rm -rf .
fi
mkdir -p examples/leaderboard
cp /tmp/claims.json examples/leaderboard/claims.json
git add examples/leaderboard/claims.json
git diff --staged --quiet || git commit -m "Update leaderboard [skip ci]"
git push origin data