Run Leaderboard Generation #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
python -m pip install --editable . | |
# Make the slim-leaderboard script executable and add to PATH | |
chmod +x src/jpl/slim/leaderboard.py | |
echo "${GITHUB_WORKSPACE}/src/jpl/slim" >> $GITHUB_PATH | |
- 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 | |
slim-leaderboard "$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-*-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 |