-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (115 loc) · 6.22 KB
/
weekly-summaries.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Contributor Updates
on:
schedule:
- cron: '30 22 * * *' # Daily at 5:30 PM EST
- cron: '0 22 * * 5' # Weekly on Friday at 5:00 PM EST
- cron: '0 22 4 * *' # Monthly on 4th at 5:00 PM EST
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'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install Node dependencies
run: npm ci
- name: Set date variables
run: |
echo "TIMESTAMP=$(date +'%Y_%m_%d')" >> $GITHUB_ENV
echo "IS_MONTH_START=$(date +'%d')" >> $GITHUB_ENV
echo "IS_FRIDAY=$(date +'%u')" >> $GITHUB_ENV
- name: Fetch daily data
if: github.event.schedule != '0 19 * * 5' && github.event.schedule != '0 19 4 * *'
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: |
# Create directories
mkdir -p data/daily data/daily/history
# Fetch current data with timestamp
bash scripts/fetch_github.sh ai16z eliza --type prs --days 1 | tee data/daily/prs.json data/daily/history/prs_${TIMESTAMP}.json
bash scripts/fetch_github.sh ai16z eliza --type issues --days 1 | tee data/daily/issues.json data/daily/history/issues_${TIMESTAMP}.json
bash scripts/fetch_github.sh ai16z eliza --type commits --days 1 | tee data/daily/commits.json data/daily/history/commits_${TIMESTAMP}.json
- name: Fetch weekly data
if: github.event.schedule == '0 19 * * 5'
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: |
# Create directories
mkdir -p data/weekly data/weekly/history
# Fetch current data with timestamp
bash scripts/fetch_github.sh ai16z eliza --type prs --days 7 | tee data/weekly/prs.json data/weekly/history/prs_${TIMESTAMP}.json
bash scripts/fetch_github.sh ai16z eliza --type issues --days 7 | tee data/weekly/issues.json data/weekly/history/issues_${TIMESTAMP}.json
bash scripts/fetch_github.sh ai16z eliza --type commits --days 7 | tee data/weekly/commits.json data/weekly/history/commits_${TIMESTAMP}.json
- name: Fetch monthly data
if: github.event.schedule == '0 19 4 * *'
env:
GH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: |
# Create directories
mkdir -p data/monthly data/monthly/history
# Fetch current data with timestamp
bash scripts/fetch_github.sh ai16z eliza --type prs --days 30 | tee data/monthly/prs.json data/monthly/history/prs_${TIMESTAMP}.json
bash scripts/fetch_github.sh ai16z eliza --type issues --days 30 | tee data/monthly/issues.json data/monthly/history/issues_${TIMESTAMP}.json
bash scripts/fetch_github.sh ai16z eliza --type commits --days 30 | tee data/monthly/commits.json data/monthly/history/commits_${TIMESTAMP}.json
- name: Process daily data
if: github.event.schedule != '0 19 * * 5' && github.event.schedule != '0 19 4 * *'
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
[ -f data/daily/contributors.json ] && mv data/daily/contributors.json data/daily/history/contributors_${TIMESTAMP}.json || true
[ -f data/daily/summary.json ] && mv data/daily/summary.json data/daily/history/summary_${TIMESTAMP}.json || true
[ -f data/daily/summary.md ] && mv data/daily/summary.md data/daily/history/summary_${TIMESTAMP}.md || true
python scripts/combine.py -p data/daily/prs.json -i data/daily/issues.json -c data/daily/commits.json -o data/daily/combined.json
python scripts/calculate_scores.py data/daily/combined.json data/daily/scored.json
python scripts/summarize.py data/daily/scored.json data/daily/contributors.json --model openai
python scripts/summarize_daily.py data/daily/contributors.json -t json data/daily/summary.json --model openai
python scripts/summarize_daily.py data/daily/contributors.json -t md data/daily/summary.md --model openai
- name: Process weekly data
if: github.event.schedule == '0 19 * * 5'
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
[ -f data/weekly/contributors.json ] && mv data/weekly/contributors.json data/weekly/history/contributors_${TIMESTAMP}.json || true
python scripts/combine.py -p data/weekly/prs.json -i data/weekly/issues.json -c data/weekly/commits.json -o data/weekly/combined.json
python scripts/calculate_scores.py data/weekly/combined.json data/weekly/scored.json
python scripts/summarize.py data/weekly/scored.json data/weekly/contributors.json --model openai
- name: Process monthly data
if: github.event.schedule == '0 19 4 * *'
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
[ -f data/monthly/contributors.json ] && mv data/monthly/contributors.json data/monthly/history/contributors_${TIMESTAMP}.json || true
python scripts/combine.py -p data/monthly/prs.json -i data/monthly/issues.json -c data/monthly/commits.json -o data/monthly/combined.json
python scripts/calculate_scores.py data/monthly/combined.json data/monthly/scored.json
python scripts/summarize.py data/monthly/scored.json data/monthly/contributors.json --model openai
- 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/
git diff --staged --quiet || (git commit -m "Update contributor data and reports [skip ci]" && git push)
env:
GITHUB_TOKEN: ${{ github.token }}