Contributor Updates #19
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: | |
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' | |
cache: 'npm' # Enable npm caching | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install openai requests | |
- name: Install Node dependencies | |
run: npm ci | |
# First fetch PR data since it's used by both analyses | |
- name: Fetch PR data | |
env: | |
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
run: | | |
mkdir -p issues_prs | |
python issues_prs/gh_issues_pr3.py ai16z/eliza -t pr -s all -f json --files > issues_prs/prs_with_files.json | |
# Then use the PR data for both contributor fetch and analysis | |
- name: Fetch and analyze contributors | |
env: | |
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
# Create directories | |
mkdir -p data/reports | |
# Get date range | |
WEEK_END=$(date +%Y-%m-%d) | |
WEEK_START=$(date -d "7 days ago" +%Y-%m-%d) | |
# Fetch contributors using PR data | |
python scripts/fetch_contributors.py ai16z eliza -o ./data -f | |
# Generate summaries | |
python scripts/generate_summaries.py ./data/contributors.json ./data/contributors.json -f | |
# Run weekly analysis using existing PR data | |
python scripts/analyze_contributors3.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/ profiles/ data/reports/ issues_prs/prs_with_files.json | |
git diff --staged --quiet || (git commit -m "Update contributor data and reports [skip ci]" && git push) | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |