Skip to content

Points Allocation

Points Allocation #9

Workflow file for this run

name: Points Allocation
on:
pull_request_review:
types: [submitted]
issue_comment:
types: [created]
permissions:
contents: write
pull-requests: write
jobs:
assign-points:
runs-on: ubuntu-latest
# Only run for PR reviews or comments on PRs (not regular issues)
if: >
github.event_name == 'pull_request_review' ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null)
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
check-latest: true
cache: 'pip'
- name: Install dependencies
run: pip install PyYAML
- name: Run points script
id: assign_points
run: |
set +e # Don't exit on error
python scripts/assign_points.py
exit_code=$?
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
# Exit codes:
# 0 = Success (points awarded)
# 2 = No-op (no points, but not an error)
# 1 or other = Actual error
if [ $exit_code -eq 0 ] || [ $exit_code -eq 2 ]; then
exit 0
else
exit $exit_code
fi
- name: Update leaderboard markdown
if: steps.assign_points.outputs.exit_code == '0'
run: python scripts/update_leaderboard.py
- name: Create Pull Request
if: steps.assign_points.outputs.exit_code == '0'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
add: 'leaderboard.json,LEADERBOARD.md'
commit-message: "Update leaderboard"
branch: leaderboard-update-${{ github.run_id }}
delete-branch: true
title: "Update contributor leaderboard"
body: |
## Leaderboard Update
This PR updates the contributor leaderboard based on recent PR review activity.
**Triggered by:** ${{ github.event_name }}
**Run:** ${{ github.run_number }}
Please review and merge to update the leaderboard.
labels: |
leaderboard
automated