Skip to content

Run Leaderboard Generation #8

Run Leaderboard Generation

Run Leaderboard Generation #8

name: Run Leaderboard Generation
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run script and prepare files
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
# First, remove any conflicting files
rm -f examples/*-leaderboard.md
# Generate new content for all JSON configs
for config in examples/*.json; do
# Extract the base name without .json extension
basename=$(basename "$config" .json)
# Generate the corresponding leaderboard file
python leaderboard.py "$config" --output_format MARKDOWN --unsorted --emoji --verbose >> "examples/${basename}-leaderboard.md"
done
# Set git config
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Stage all changes (including deletions and new files)
git add examples/
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.TOKEN }}
commit-message: 'Update SLIM leaderboards'
title: '🏆 Auto: Update SLIM Leaderboards'
body: |
Automated PR to update SLIM leaderboards
Updates made to:
- examples/slim-fprime-leaderboard.md
- examples/slim-ammos-leaderboard.md
Generated by GitHub Actions - please review the changes.
branch: update-slim-leaderboards
base: main
delete-branch: true
labels: |
automated-pr
leaderboard-update
create-branch: true
branch-suffix: timestamp