Skip to content

Commit c0928f9

Browse files
committed
ci: add dump-refresh workflow (scrape-free dump → TechAPI PR)
Regenerates site/public/v1 from current data and opens a TechAPI PR, without the weekly live scrape — used to re-publish the dump after engine-side serialization changes such as the scoring v2.0.0 bump. Refs #1
1 parent 6612318 commit c0928f9

1 file changed

Lines changed: 93 additions & 0 deletions

File tree

.github/workflows/dump-refresh.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: dump-refresh
2+
3+
# On-demand: regenerate the static v1 dump from the CURRENT TechAPI data (no
4+
# scraping) and open a refresh PR to TechAPI. Use this to re-publish the dump
5+
# after an engine-side change that affects serialized output (e.g. a scoring
6+
# version bump) — weekly-refresh.yml also does this but behind a slow live scrape.
7+
on:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: dump-refresh
15+
cancel-in-progress: false
16+
17+
jobs:
18+
dump:
19+
runs-on: ubuntu-latest
20+
env:
21+
TECHAPI_WRITE_TOKEN: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN }}
22+
# seed/validate/dump read the data tree from here.
23+
TECHAPI_DATA_DIR: ${{ github.workspace }}/techapi/data
24+
steps:
25+
- name: Checkout TechEngine
26+
uses: actions/checkout@v4
27+
28+
- name: Checkout TechAPI
29+
uses: actions/checkout@v4
30+
with:
31+
repository: GetTechAPI/TechAPI
32+
path: techapi
33+
token: ${{ secrets.TECHENGINEBOT_TOKEN || secrets.TECHAPI_TOKEN || secrets.GITHUB_TOKEN }}
34+
35+
- uses: actions/setup-python@v5
36+
with:
37+
python-version: "3.12"
38+
cache: pip
39+
40+
- name: Install TechEngine
41+
run: pip install -e .
42+
43+
- name: Compute date
44+
id: meta
45+
run: echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
46+
47+
# Integrity gate: never publish a dump from data that fails the validator.
48+
- name: Validate (schema / range / slug / FK)
49+
run: python -m app.validate
50+
51+
- name: Generate static dump → site/public
52+
run: python -m app.dump --output ./techapi/site/public
53+
54+
- name: Build PR body
55+
run: |
56+
{
57+
echo "# Dump refresh — ${{ steps.meta.outputs.date }}"
58+
echo
59+
echo "Regenerates \`site/public/v1\` from the current data with no re-scrape."
60+
echo "Picks up engine-side serialization changes (scoring v2.0.0: hybrid"
61+
echo "absolute+relative scores for smartphones/CPUs/GPUs/SoCs, \`/score\` files,"
62+
echo "\`scored\` manifest counts)."
63+
echo
64+
echo "- \`app.validate\` (schema/range/slug/FK): **passed**"
65+
} > pr-body.md
66+
67+
- name: Upload dump artifact (no-token fallback)
68+
if: env.TECHAPI_WRITE_TOKEN == ''
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: dump-${{ steps.meta.outputs.date }}
72+
path: |
73+
techapi/site/public/v1
74+
techapi/site/public/openapi.json
75+
if-no-files-found: ignore
76+
77+
- name: Create dump-refresh PR
78+
if: env.TECHAPI_WRITE_TOKEN != ''
79+
uses: peter-evans/create-pull-request@v6
80+
with:
81+
path: ./techapi
82+
token: ${{ env.TECHAPI_WRITE_TOKEN }}
83+
branch: dump-refresh/${{ steps.meta.outputs.date }}
84+
base: main
85+
add-paths: |
86+
site/public/v1
87+
site/public/openapi.json
88+
commit-message: "chore(site): refresh public dump for scoring v2.0.0"
89+
title: "chore(site): refresh public dump (scoring v2.0.0)"
90+
body-path: pr-body.md
91+
committer: TechEngineBot <289859915+TechEngineBot@users.noreply.github.com>
92+
author: TechEngineBot <289859915+TechEngineBot@users.noreply.github.com>
93+
delete-branch: true

0 commit comments

Comments
 (0)