-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 3.79 KB
/
Copy pathanalyze.yml
File metadata and controls
91 lines (78 loc) · 3.79 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
name: Analyze addons
on:
schedule:
# Mondays 06:00 UTC — the addon cache expires weekly, so each run lands a fresh snapshot
- cron: "0 6 * * 1"
workflow_dispatch:
push:
branches: [main]
paths: ["src/**"]
permissions:
contents: write # committing history/ snapshots
pages: write # deploying the report
id-token: write # OIDC handshake for deploy-pages
# One run at a time so a manual dispatch can't race the weekly push
concurrency:
group: analyze
cancel-in-progress: false
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
# Pin the addon corpus for the ISO week (weeks start Monday, same as the cron):
# the Monday run misses, downloads fresh, and saves; later runs that week reuse
# it, so their snapshots carry the same dataDate and identical data — matching
# how the local weekly cache behaves. Eviction just means one extra download.
- name: Compute cache week
id: week
run: echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT"
# restore-keys makes a new week start from the newest previous corpus instead of an empty
# directory. The run still refreshes everything (the week key changed, so isInvalid() is
# true) — the difference is only what happens when a source URL is dead: with last week's
# file present the addon degrades to stale content, without it the addon vanishes from the
# corpus entirely. Ten addons were in exactly that state on 2026-08-10 (two authors deleted
# their repos), which a from-scratch CI download would have turned into a 10-addon hole.
# This is what makes pruneOrphans() necessary: delisted addons now arrive here too.
- uses: actions/cache@v4
with:
path: .cache
key: addon-corpus-${{ steps.week.outputs.week }}
restore-keys: addon-corpus-
# On a cache miss this downloads the full corpus AND fetches every theme's remote
# @import graph into .cache/imports (both covered by the cache above). On a cache
# hit the run is offline apart from retrying any addon that failed to download:
# updateImports() is gated on the corpus dataDate, and fillGaps() only touches the
# sources with no copy on disk. A dead addon source is annotated, not fatal, until
# more than min(5, 2%) are missing; only a store-list failure fails the run outright
# (rerun via workflow_dispatch or wait a week).
- run: bun run analyze
# With the corpus cached, a mid-week push produces the same snapshot and this
# would no-op — but the gate still matters for two cases: a push that changes
# analysis code (same dataDate, different numbers — it must not silently rewrite
# the committed Monday snapshot) and a cache eviction (fresh download stamps the
# push day, an off-cadence dataDate). Only cron and a deliberate manual dispatch
# (e.g. recovering a failed Monday) persist history; push runs just redeploy.
- name: Commit history snapshot
if: github.event_name != 'push'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add history
git diff --cached --quiet || (git commit -m "chore: weekly analysis snapshot" && git push)
- name: Stage report for Pages
run: mkdir -p _site && cp results/report.html _site/index.html
- uses: actions/upload-pages-artifact@v5
with:
path: _site
deploy:
needs: analyze
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5