Contributor Updates #17
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 & Node.js | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' # Enable pip caching | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' # Enable npm caching | |
- name: Cache API responses | |
uses: actions/cache@v3 | |
with: | |
path: | | |
.cache/github_api | |
.cache/openai_api | |
key: ${{ runner.os }}-api-cache-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-api-cache- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
npm ci | |
# Combined PR and contributor data fetch | |
- name: Fetch GitHub data | |
env: | |
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
run: | | |
# Create directories | |
mkdir -p data/reports issues_prs | |
# Get date range | |
WEEK_END=$(date +%Y-%m-%d) | |
WEEK_START=$(date -d "7 days ago" +%Y-%m-%d) | |
# Single API call to fetch both PRs and contributor data | |
python scripts/fetch_combined_data.py \ | |
--repo ai16z/eliza \ | |
--start-date "$WEEK_START" \ | |
--end-date "$WEEK_END" \ | |
--output-dir ./data | |
- name: Generate analysis | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
WEEK_END=$(date +%Y-%m-%d) | |
# Generate summaries and analysis in parallel | |
python scripts/parallel_analysis.py \ | |
--input-dir ./data \ | |
--output-dir ./data/reports \ | |
--date "$WEEK_END" | |
- name: Build and deploy | |
run: | | |
npm run build | |
npm run generate | |
- name: Commit changes | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
# Stage all changes at once | |
git add data/ profiles/ data/reports/ issues_prs/ | |
# Single commit | |
git diff --staged --quiet || git commit -m "Update contributor data and reports [skip ci]" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |