-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollect-data.sh
More file actions
executable file
·66 lines (51 loc) · 1.86 KB
/
Copy pathcollect-data.sh
File metadata and controls
executable file
·66 lines (51 loc) · 1.86 KB
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
#!/bin/bash
# Load environment variables
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
export $(grep -v '^#' "$SCRIPT_DIR/.env" | xargs)
fi
env | grep GITHUB
TIMESTAMP=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
DATE=$(date -u '+%Y-%m-%d')
NEW_DATA_POINTS=0
track_agent() {
local AGENT="$1"
local URL="https://github.com/search?q=%22$AGENT%22&type=commits"
local DIR="$SCRIPT_DIR"
local JSON_FILE="$DIR/data/${AGENT}_${TIMESTAMP}.json"
mkdir -p "$DIR/html/$AGENT"
curl -s -H "Authorization: token $GITHUB_TOKEN" -o "$DIR/html/$AGENT/html-${TIMESTAMP}.html" "$URL"
curl -s "https://api.github.com/search/commits?q=%22$AGENT%22+author-date%3A2020-01-01..${DATE}&per_page=100&sort=author-date&incomplete_results=True" \
-H "Accept: application/vnd.github.cloak-preview" \
-H "Authorization: token $GITHUB_TOKEN" \
-o "$JSON_FILE"
if grep -q "You have exceeded a secondary rate limit" "$JSON_FILE"; then
echo "Rate limit exceeded for $AGENT, deleting $JSON_FILE"
rm "$JSON_FILE"
return
fi
COUNT=$(jq '.total_count' "$JSON_FILE")
echo "$TIMESTAMP, $COUNT" >> "$DIR/${AGENT}_commits.csv"
DATA_POINTS=$(jq '.items | length' "$JSON_FILE")
NEW_DATA_POINTS=$((NEW_DATA_POINTS+DATA_POINTS))
sleep 5
}
NEW_DATA_POINTS=0
# Anthropic / Claude
track_agent "noreply%40anthropic.com"
# OpenAI Codex
track_agent "codex%40openai.com"
# GitHub Copilot
track_agent "copilot%40users.noreply.github.com"
# Google Gemini
track_agent "gemini-code-assist%40google.com"
# Cognition / Devin
#track_agent "devin%40cognition.ai"
track_agent "devin-ai-integration[bot]"
# Cursor
#track_agent "cursor%40anysphere.io"
track_agent "cursoragent%40cursor.com"
cd "$SCRIPT_DIR"
git add data/*json
git commit -m "automated commit ($NEW_DATA_POINTS new data points)" --author="assert-bot <castor-bot@eecs.kth.se>" -a
git push origin main