Skip to content

Refresh prices & rebuild dashboard #51

Refresh prices & rebuild dashboard

Refresh prices & rebuild dashboard #51

name: Refresh prices & rebuild dashboard
on:
workflow_dispatch:
schedule:
# Weekdays 21:35 UTC ≈ after US market close; refreshes caches and redeploys Pages.
- cron: "35 21 * * 1-5"
permissions:
contents: write
concurrency:
group: refresh-prices
cancel-in-progress: false
jobs:
refresh:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Refresh 3mo prices (movers / sparklines)
# Refreshes the 3mo cache only when >6h old; reused otherwise.
# Yahoo hard-blocks GitHub runner IPs, so this often no-ops — that's fine,
# the committed cache is reused and Nasdaq below supplies the deep history.
run: node scripts/build-aleabito-dashboard.js --skip-deep || true
- name: Backfill deep 2y history via Nasdaq (free, keyless, US + ETF benches)
# Primary deep source: Nasdaq isn't rate-limited like Yahoo. Fills US
# tickers + SPY/SMH; foreign listings are topped up by Yahoo when available.
run: python3 scripts/nasdaq-deep-backfill.py || true
- name: Top up foreign deep history via Yahoo (best-effort)
run: node scripts/build-aleabito-dashboard.js --skip-3mo || true
- name: Rebuild dashboard from caches
run: node scripts/build-aleabito-dashboard.js --no-prices
- name: Report deep-cache coverage
run: |
python3 - <<'EOF'
import json, io
c = json.load(io.open('reports/aleabito-price-deep-cache.json'))
s = c.get('series', {})
ok = [k for k, v in s.items() if v.get('daily')]
print('deep series with data:', len(ok))
print('SPY:', bool((s.get('SPY') or {}).get('daily')), '| SMH:', bool((s.get('SMH') or {}).get('daily')))
EOF
- name: Commit refreshed caches and dashboard
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add reports/aleabito-price-cache.json reports/aleabito-price-deep-cache.json reports/aleabito-60d-dashboard.html
if git diff --cached --quiet; then
echo "No price changes to commit."
exit 0
fi
git commit -m "ci: refresh price caches + rebuild dashboard"
git push