forked from yakew7/Fair-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (61 loc) · 2.73 KB
/
Copy pathbuild-explainers.yml
File metadata and controls
69 lines (61 loc) · 2.73 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
name: Build Explainers
# Verifies explainers/*.html, assets/explainers-data.js, sitemap.xml, and
# llms-full.txt are byte-exact with their sources (explainers/*.md,
# assets/explainers-data.json), and that assets/og/*.png +
# assets/og-light/*.png (dark and light OG/Twitter social-preview cards)
# exist, are non-empty, and are correctly sized for every current
# explainer - not byte- or pixel-compared against this job's own fresh
# regeneration, since Pillow's bundled FreeType renders text with
# genuinely different pixels across platforms (see
# scripts/check_generated_files_current.py's docstring).
#
# main requires a PR (branch protection), and github-actions[bot] isn't in
# that ruleset's bypass list, so this can no longer auto-commit a fix by
# pushing straight to main. Contributors already run `make build-explainers`
# locally before opening a PR (see CONTRIBUTING.md) - this job just fails
# the check if that step was skipped, instead of silently drifting or
# erroring out trying to push.
on:
push:
branches: [main]
paths:
- "explainers/**.md"
- "assets/explainers-data.json"
- "assets/explainers-ui.js"
- "scripts/build_explainers.py"
- "scripts/generate_og_images.py"
- "scripts/check_generated_files_current.py"
pull_request:
paths:
- "explainers/**.md"
- "assets/explainers-data.json"
- "assets/explainers-ui.js"
- "scripts/build_explainers.py"
- "scripts/generate_og_images.py"
- "scripts/check_generated_files_current.py"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Install Pillow (OG image generation)
run: python -m pip install --upgrade pip "pillow==11.1.0"
- name: Generate explainer pages, data.js, and sitemap
run: python3 scripts/build_explainers.py
- name: Generate OG/Twitter social preview images
run: python3 scripts/generate_og_images.py
- name: Fail if generated files are out of date
# scripts/check_generated_files_current.py deliberately does NOT
# compare the OG PNGs against this job's own fresh regeneration -
# Pillow's bundled FreeType renders the same text with different
# pixels on this Ubuntu runner than on a contributor's machine (see
# #262 and its follow-up), so byte- or pixel-level comparison always
# false-positives here regardless of how the PNG is saved. It checks
# existence/size/dimensions instead, which is platform-independent.
# Text-based generated files still get an exact git diff.
run: python3 scripts/check_generated_files_current.py