Remove ihh test entry #4
This file contains hidden or 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: Validate entries | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'entries/**' | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: pip install -r ci/requirements.txt | |
| - name: Identify modified entries | |
| id: entries | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| # For PRs, diff against the base branch | |
| git fetch origin ${{ github.base_ref }} --depth=1 | |
| CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD -- entries/ \ | |
| | cut -d/ -f2 | sort -u | grep -v '^$' || true) | |
| else | |
| CHANGED=$(git diff --name-only HEAD~1 HEAD -- entries/ \ | |
| | cut -d/ -f2 | sort -u | grep -v '^$' || true) | |
| fi | |
| echo "entries=$CHANGED" >> "$GITHUB_OUTPUT" | |
| echo "Modified entries: $CHANGED" | |
| - name: No entries changed | |
| if: steps.entries.outputs.entries == '' | |
| run: echo "No entry changes detected — nothing to validate." | |
| - name: Remove scores for deleted entries | |
| if: github.event_name == 'push' && steps.entries.outputs.entries != '' | |
| run: | | |
| for TEAM in ${{ steps.entries.outputs.entries }}; do | |
| if [ ! -d "entries/$TEAM" ]; then | |
| echo "=== Entry $TEAM was deleted, removing score ===" | |
| rm -f "scores/$TEAM.json" | |
| rm -f "docs/scores/$TEAM.json" | |
| fi | |
| done | |
| - name: Validate entries | |
| if: steps.entries.outputs.entries != '' | |
| run: | | |
| COMMIT=$(git rev-parse --short HEAD) | |
| EXIT=0 | |
| for TEAM in ${{ steps.entries.outputs.entries }}; do | |
| if [ ! -d "entries/$TEAM" ]; then | |
| echo "=== Skipping deleted entry $TEAM ===" | |
| continue | |
| fi | |
| echo "=== Validating $TEAM ===" | |
| python ci/validate.py \ | |
| --entry "entries/$TEAM" \ | |
| --commit "$COMMIT" \ | |
| --scores-dir scores \ | |
| --leaderboard leaderboard.json || EXIT=1 | |
| done | |
| # Rebuild leaderboard to reflect any deletions | |
| python -c " | |
| from pathlib import Path; import sys; sys.path.insert(0, 'ci') | |
| from validate import update_leaderboard | |
| update_leaderboard(Path('scores'), Path('leaderboard.json')) | |
| " | |
| exit $EXIT | |
| - name: Update GitHub Pages data | |
| if: github.event_name == 'push' && steps.entries.outputs.entries != '' | |
| run: | | |
| mkdir -p docs/scores | |
| cp leaderboard.json docs/ 2>/dev/null || true | |
| cp scores/*.json docs/scores/ 2>/dev/null || true | |
| # Remove stale docs scores | |
| for f in docs/scores/*.json; do | |
| [ -f "$f" ] || continue | |
| base=$(basename "$f") | |
| [ -f "scores/$base" ] || rm -f "$f" | |
| done | |
| - name: Create score update PR | |
| if: github.event_name == 'push' && steps.entries.outputs.entries != '' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| commit-message: "Update scores and leaderboard" | |
| title: "Update scores and leaderboard" | |
| body: "Automated score update from validation pipeline." | |
| branch: auto/update-scores | |
| delete-branch: true | |
| add-paths: | | |
| scores/ | |
| leaderboard.json | |
| docs/leaderboard.json | |
| docs/scores/ |