Skip to content

Commit fe64639

Browse files
HeyItsGilbertclaude
andcommitted
ci: fail PRs when committed Tailwind/Font Awesome assets are stale
Deploys ship the committed, purged CSS and subsetted webfonts as-is (bare hugo, not the build:* scripts), so a markup/content change that adds a Tailwind class or fa-* icon silently renders wrong until someone regenerates them — exactly how w-auto slipped through. Add a freshness check to the PR build: regenerate via build:css and build:icons, then fail if assets/css/tailwind.css or assets/css/fontawesome-subset.css differ from what is committed, with a message telling the dev to regenerate and commit. Diffs the generated CSS (deterministic, the source of truth for included classes/icons) rather than the woff2 bytes, which vary across subset-font versions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 66c25e7 commit fe64639

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,25 @@ jobs:
6868
EOF
6969
fi
7070
71+
# Deploys ship the committed, purged assets/css/*.css and subsetted
72+
# assets/fonts/fa-*-subset.woff2 as-is (deploy runs bare hugo, not the
73+
# build:* scripts). This guard regenerates them and fails the PR if the
74+
# committed CSS is stale, so markup/content changes that add Tailwind
75+
# classes or fa-* icons can't merge without the regenerated assets.
76+
# We diff the generated CSS (deterministic and the source of truth for
77+
# which classes/icons are included), not the woff2 bytes, which can vary
78+
# across subset-font versions.
79+
- name: Verify generated assets are up to date
80+
run: |
81+
npm run build:css
82+
npm run build:icons
83+
if ! git diff --quiet -- assets/css/tailwind.css assets/css/fontawesome-subset.css; then
84+
echo "::error::Generated CSS is out of date. Run 'npm run build:css' and 'npm run build:icons' locally and commit assets/css/*.css and assets/fonts/fa-*-subset.woff2."
85+
git diff --stat -- assets/css/tailwind.css assets/css/fontawesome-subset.css
86+
git --no-pager diff -- assets/css/fontawesome-subset.css
87+
exit 1
88+
fi
89+
7190
- name: Build with Hugo
7291
env:
7392
HUGO_ENVIRONMENT: production

0 commit comments

Comments
 (0)