-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (76 loc) · 3.65 KB
/
Copy pathrefresh-dashboard.yml
File metadata and controls
94 lines (76 loc) · 3.65 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
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
name: Refresh dashboard
# Manual-only, by design: this regenerates every strategy's recommended squad
# and rebuilds the website, but never touches a real FPL team (it only ever
# calls public, unauthenticated API endpoints -- no secrets needed) and never
# submits anything. "the team is updated manually not auto done" applies here
# too, not just to live-pipeline.yml's real submission -- so unlike
# data-snapshot.yml this does not run on a schedule. Trigger it by hand from
# the Actions tab whenever you want the dashboard to reflect the latest
# prices/news, or after a gameweek finishes.
on:
workflow_dispatch:
inputs:
refresh_backtest:
description: 'Also re-run the 2025-26 backtest for all strategies (slow -- only needed after a model/strategy code change)'
type: boolean
default: false
permissions:
contents: write
jobs:
refresh:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
- run: pip install -r requirements.txt
- name: Fetch historical training data
run: python model/fetch_historical_data.py
- name: Re-run 2025-26 backtest for all strategies
if: inputs.refresh_backtest
run: python model/run_all_strategies.py
- name: Re-run 2025-26 xG Experimental backtest
if: inputs.refresh_backtest
run: python model/run_xg_strategy.py
- name: Generate live 2026-27 strategies
run: python model/generate_live_strategies.py
- name: Generate live 2026-27 xG Experimental
run: python model/generate_live_xg_strategy.py
- name: Rebuild website
run: python website/build_site.py
- name: Commit and push
run: |
git config user.name "plfantasybot-dashboard"
git config user.email "actions@users.noreply.github.com"
# This job runs up to 60 minutes; anything else pushed to main in
# that window (a direct edit to build_site.py, another workflow's
# commit) collides here, because website/index.html is a fully
# regenerated file -- git has no sensible way to merge two
# independent regenerations of it, so a plain pull --rebase just
# fails outright (seen for real: run #5, 2026-08-21, 18 minutes of
# work lost to a rebase conflict against an unrelated footer
# commit). Fix: snapshot this run's fresh output first, reset
# cleanly to whatever main now is, copy the fresh data back in,
# and rebuild the site from *that* -- which also means a
# concurrent build_site.py change gets picked up for free instead
# of being clobbered.
tmp=$(mktemp -d)
cp data/live_squads_*.json data/live_state_*.json \
data/strategies_manifest_2026-27.json data/strategies_manifest_2025-26.json \
data/season_2025-26_squads_*.json data/season_2025-26_simulation_*.csv \
"$tmp"/ 2>/dev/null || true
git fetch origin main
git reset --hard origin/main
cp "$tmp"/*.json "$tmp"/*.csv data/ 2>/dev/null || true
python website/build_site.py
git add data/live_squads_*.json data/live_state_*.json \
data/strategies_manifest_2026-27.json \
data/strategies_manifest_2025-26.json \
data/season_2025-26_squads_*.json data/season_2025-26_simulation_*.csv \
website/index.html
git diff --staged --quiet && exit 0
git commit -m "Refresh dashboard $(date -u +'%Y-%m-%d %H:%M UTC')"
git push