Contributor Updates #15
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: Weekly Contributor Update | |
on: | |
schedule: | |
- cron: '0 19 * * 5' # Run at 2:00 PM EST (19:00 UTC) every Friday | |
workflow_dispatch: # Allow manual triggers | |
permissions: | |
contents: write | |
jobs: | |
update-contributors: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install openai requests | |
- name: Install Node dependencies | |
run: npm ci | |
- name: Fetch latest contributor data | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} # For your Python script | |
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} # For gh cli commands | |
run: | | |
python scripts/fetch_contributors.py ai16z eliza -o ./data -f | |
- name: Generate summaries | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
python scripts/generate_summaries.py ./data/contributors.json ./data/contributors.json -f | |
python scripts/compute_scores.py ./data/contributors.json ./data/contributors.json -f | |
- name: Fetch PR data with files | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} # For your Python script | |
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} # For gh cli commands | |
run: | | |
# Create directories if they don't exist | |
mkdir -p issues_prs | |
mkdir -p data/reports | |
# Get date for filename and analysis | |
WEEK_END=$(date +%Y-%m-%d) | |
WEEK_START=$(date -d "7 days ago" +%Y-%m-%d) | |
# Fetch PR data with files | |
python issues_prs/gh_issues_pr3.py ai16z/eliza -t pr -s all -f json --files > issues_prs/prs_with_files.json | |
- name: Run weekly PR analysis | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
WEEK_END=$(date +%Y-%m-%d) | |
WEEK_START=$(date -d "7 days ago" +%Y-%m-%d) | |
# Run analysis using the fetched PR data | |
python scripts/analyze_contributors2.py \ | |
issues_prs/prs_with_files.json \ | |
"data/reports/weekly-${WEEK_END}.json" \ | |
--after "$WEEK_START" \ | |
--before "$WEEK_END" \ | |
-f | |
- name: Build and generate site | |
run: | | |
npm run build | |
npm run generate | |
- name: Commit and push if changed | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add data/ | |
git add profiles/ | |
git add data/reports/ | |
git add issues_prs/prs_with_files.json | |
git diff --quiet && git diff --staged --quiet || (git commit -m "Update contributor data, summaries, and weekly report [skip ci]" && git push) | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |