Skip to content

Commit e543d38

Browse files
Add cargurus trend data
1 parent 39c439a commit e543d38

32 files changed

+9159
-26
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Scrape CarGurus Price Trends
2+
3+
on:
4+
# Run every other day at 2 AM UTC
5+
schedule:
6+
- cron: '0 2 */2 * *'
7+
8+
# Allow manual trigger for testing
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
scrape-cargurus:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '20'
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Install Chromium for Puppeteer
32+
run: |
33+
npx puppeteer browsers install chrome
34+
35+
- name: Run CarGurus trends scraper
36+
run: |
37+
node scrapers/run-all.js --source=cargurus-trend
38+
continue-on-error: true
39+
env:
40+
# Run in CI mode (headless, no sandbox)
41+
CI: true
42+
43+
- name: Check scraper results
44+
id: scraper-status
45+
run: |
46+
if [ -d "data/cargurus-trend" ] && [ "$(ls -A data/cargurus-trend/*.csv 2>/dev/null | wc -l)" -gt 0 ]; then
47+
echo "scrapers_succeeded=true" >> $GITHUB_OUTPUT
48+
echo "✓ CarGurus scraper completed successfully"
49+
else
50+
echo "scrapers_succeeded=false" >> $GITHUB_OUTPUT
51+
echo "⚠️ No CarGurus data found"
52+
fi
53+
54+
- name: Commit CarGurus data
55+
if: steps.scraper-status.outputs.scrapers_succeeded == 'true'
56+
run: |
57+
git config user.name "github-actions[bot]"
58+
git config user.email "github-actions[bot]@users.noreply.github.com"
59+
60+
# Add only CarGurus trend data
61+
git add data/cargurus-trend/
62+
63+
# Check if there are changes to commit
64+
if git diff --staged --quiet; then
65+
echo "No new data to commit"
66+
exit 0
67+
fi
68+
69+
DATE=$(date +%Y-%m-%d)
70+
CSV_COUNT=$(find data/cargurus-trend -name "*.csv" | wc -l | tr -d ' ')
71+
git commit -m "chore: update CarGurus trends for $DATE ($CSV_COUNT models)" -m "Generated with GitHub Actions"
72+
73+
# Try to push, handle concurrent commits
74+
if git push; then
75+
echo "✓ Push succeeded"
76+
else
77+
echo "⚠️ Push failed, attempting to recover..."
78+
79+
# Stash our commit temporarily
80+
git reset --soft HEAD~1
81+
git stash
82+
83+
# Pull latest changes
84+
git pull --rebase
85+
86+
# Try to restore our changes
87+
if git stash pop; then
88+
echo "✓ Stash applied successfully, retrying commit..."
89+
90+
# Re-add and commit
91+
git add data/cargurus-trend/
92+
if git diff --staged --quiet; then
93+
echo "No new data after merge (likely already committed)"
94+
exit 0
95+
fi
96+
97+
CSV_COUNT=$(find data/cargurus-trend -name "*.csv" | wc -l | tr -d ' ')
98+
git commit -m "chore: update CarGurus trends for $DATE ($CSV_COUNT models)" -m "Generated with GitHub Actions"
99+
git push
100+
else
101+
echo "✗ Conflict detected - scrape data for this day may already exist"
102+
git stash drop || true
103+
exit 1
104+
fi
105+
fi

data/cargurus-trend/audi-q4-e-tron.csv

Lines changed: 340 additions & 0 deletions
Large diffs are not rendered by default.

data/cargurus-trend/bmw-i3.csv

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
Date,Price,Car Type,Avg Price,Last 30 days,Last 90 days,YoY Change
2+
07-18-2025,9736.547394259818,BMW i3,8738,-6.6,-16.38,-35.38
3+
07-20-2025,9701.812125748504,BMW i3,8738,-6.6,-16.38,-35.38
4+
07-22-2025,9384.765919811322,BMW i3,8738,-6.6,-16.38,-35.38
5+
07-24-2025,9990.45106281726,BMW i3,8738,-6.6,-16.38,-35.38
6+
07-26-2025,10589.267088014982,BMW i3,8738,-6.6,-16.38,-35.38
7+
07-28-2025,10039.76220703125,BMW i3,8738,-6.6,-16.38,-35.38
8+
07-30-2025,9655.786072530864,BMW i3,8738,-6.6,-16.38,-35.38
9+
08-01-2025,9959.48779296875,BMW i3,8738,-6.6,-16.38,-35.38
10+
08-03-2025,9219.540909090909,BMW i3,8738,-6.6,-16.38,-35.38
11+
08-05-2025,9900.760416666666,BMW i3,8738,-6.6,-16.38,-35.38
12+
08-07-2025,9862.003676470587,BMW i3,8738,-6.6,-16.38,-35.38
13+
08-09-2025,9830.370078740158,BMW i3,8738,-6.6,-16.38,-35.38
14+
08-11-2025,9794.639344262296,BMW i3,8738,-6.6,-16.38,-35.38
15+
08-13-2025,9304.261842105263,BMW i3,8738,-6.6,-16.38,-35.38
16+
08-15-2025,9690.501050420167,BMW i3,8738,-6.6,-16.38,-35.38
17+
08-17-2025,10367.841981132075,BMW i3,8738,-6.6,-16.38,-35.38
18+
08-19-2025,10767.14368718593,BMW i3,8738,-6.6,-16.38,-35.38
19+
08-21-2025,10669.770352564103,BMW i3,8738,-6.6,-16.38,-35.38
20+
08-23-2025,10170.999793046358,BMW i3,8738,-6.6,-16.38,-35.38
21+
08-25-2025,10182.611637931035,BMW i3,8738,-6.6,-16.38,-35.38
22+
08-27-2025,9333.0,BMW i3,8738,-6.6,-16.38,-35.38
23+
08-29-2025,9355.89699074074,BMW i3,8738,-6.6,-16.38,-35.38
24+
08-31-2025,9375.26634174312,BMW i3,8738,-6.6,-16.38,-35.38
25+
09-02-2025,9393.345224056604,BMW i3,8738,-6.6,-16.38,-35.38
26+
09-04-2025,9433.958235981308,BMW i3,8738,-6.6,-16.38,-35.38
27+
09-06-2025,9074.437823834196,BMW i3,8738,-6.6,-16.38,-35.38
28+
09-08-2025,9230.10761589404,BMW i3,8738,-6.6,-16.38,-35.38
29+
09-10-2025,9510.86244419643,BMW i3,8738,-6.6,-16.38,-35.38
30+
09-12-2025,10656.854272959185,BMW i3,8738,-6.6,-16.38,-35.38
31+
09-14-2025,10246.638632550335,BMW i3,8738,-6.6,-16.38,-35.38
32+
09-16-2025,10263.76198630137,BMW i3,8738,-6.6,-16.38,-35.38
33+
09-18-2025,10739.363495024876,BMW i3,8738,-6.6,-16.38,-35.38
34+
09-20-2025,10711.035211267606,BMW i3,8738,-6.6,-16.38,-35.38
35+
09-22-2025,10687.274154589371,BMW i3,8738,-6.6,-16.38,-35.38
36+
09-24-2025,10602.127063679245,BMW i3,8738,-6.6,-16.38,-35.38
37+
09-26-2025,10468.390625,BMW i3,8738,-6.6,-16.38,-35.38
38+
09-28-2025,9610.582351823708,BMW i3,8738,-6.6,-16.38,-35.38
39+
09-30-2025,9906.636618589744,BMW i3,8738,-6.6,-16.38,-35.38
40+
10-02-2025,8785.783125,BMW i3,8738,-6.6,-16.38,-35.38
41+
10-04-2025,8764.020753816794,BMW i3,8738,-6.6,-16.38,-35.38
42+
10-06-2025,8718.594439338236,BMW i3,8738,-6.6,-16.38,-35.38
43+
10-08-2025,8678.624522900764,BMW i3,8738,-6.6,-16.38,-35.38
44+
10-10-2025,9000.275406504064,BMW i3,8738,-6.6,-16.38,-35.38
45+
10-12-2025,8736.93205128205,BMW i3,8738,-6.6,-16.38,-35.38
46+
10-14-2025,8596.93093385214,BMW i3,8738,-6.6,-16.38,-35.38
47+
10-16-2025,8693.90192819149,BMW i3,8738,-6.6,-16.38,-35.38
48+
10-18-2025,8918.688550420167,BMW i3,8738,-6.6,-16.38,-35.38
49+
10-20-2025,8908.210416666667,BMW i3,8738,-6.6,-16.38,-35.38
50+
10-22-2025,8910.8984375,BMW i3,8738,-6.6,-16.38,-35.38
51+
10-24-2025,8911.139880952382,BMW i3,8738,-6.6,-16.38,-35.38
52+
10-26-2025,8881.0035,BMW i3,8738,-6.6,-16.38,-35.38
53+
10-28-2025,8841.994959677419,BMW i3,8738,-6.6,-16.38,-35.38
54+
10-30-2025,8796.22127016129,BMW i3,8738,-6.6,-16.38,-35.38
55+
11-01-2025,8753.611607142857,BMW i3,8738,-6.6,-16.38,-35.38
56+
11-03-2025,8713.290846456694,BMW i3,8738,-6.6,-16.38,-35.38
57+
11-05-2025,8696.384794776119,BMW i3,8738,-6.6,-16.38,-35.38
58+
11-07-2025,10069.794491525423,BMW i3,8738,-6.6,-16.38,-35.38
59+
11-09-2025,11000.756425233645,BMW i3,8738,-6.6,-16.38,-35.38
60+
11-11-2025,10131.12897398844,BMW i3,8738,-6.6,-16.38,-35.38
61+
11-13-2025,8517.107652091256,BMW i3,8738,-6.6,-16.38,-35.38
62+
11-15-2025,9992.773459885388,BMW i3,8738,-6.6,-16.38,-35.38
63+
11-17-2025,8526.357175925927,BMW i3,8738,-6.6,-16.38,-35.38
64+
11-19-2025,9607.841536827196,BMW i3,8738,-6.6,-16.38,-35.38
65+
11-21-2025,9816.00078517588,BMW i3,8738,-6.6,-16.38,-35.38
66+
11-23-2025,10206.126558956916,BMW i3,8738,-6.6,-16.38,-35.38
67+
11-25-2025,9716.972283291458,BMW i3,8738,-6.6,-16.38,-35.38
68+
11-27-2025,9774.894986749117,BMW i3,8738,-6.6,-16.38,-35.38
69+
11-29-2025,8442.759935897437,BMW i3,8738,-6.6,-16.38,-35.38
70+
12-01-2025,8376.964721679688,BMW i3,8738,-6.6,-16.38,-35.38
71+
12-03-2025,9033.488516566265,BMW i3,8738,-6.6,-16.38,-35.38
72+
12-05-2025,8985.946560650887,BMW i3,8738,-6.6,-16.38,-35.38
73+
12-07-2025,8994.755664652568,BMW i3,8738,-6.6,-16.38,-35.38
74+
12-09-2025,9001.161854103344,BMW i3,8738,-6.6,-16.38,-35.38
75+
12-11-2025,8979.351253799392,BMW i3,8738,-6.6,-16.38,-35.38
76+
12-13-2025,8976.344962686568,BMW i3,8738,-6.6,-16.38,-35.38
77+
12-15-2025,8716.42493556701,BMW i3,8738,-6.6,-16.38,-35.38
78+
© 2025 CarGurus, Inc., All Rights Reserved.

0 commit comments

Comments
 (0)