You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Future non-tech contributors will add images by dragging files into the repo (or via the planned content-authoring skills). Expecting them to run pnpm install && node scripts/optimize-assets.js --write locally is a non-starter — they don't have Node, won't remember the step, and a missed run silently bloats the new blob store.
Manual compression doesn't scale. The repo needs a guardrail.
What to build
GitHub Action that runs on every PR touching posts/assets/**:
Checkout the PR branch with write permission (use a GitHub App token, or actions/checkout with persist-credentials + a PAT, or the built-in GITHUB_TOKEN configured with contents: write and pull-requests: write)
DX follow-up from #41 — companion to #45. Together they form the non-tech contributor flow: drag image into PR → CI compresses + commits back → reviewer sees the cleaned diff. No local Node setup required.
Same approach could later be extended to: lint frontmatter, validate Zod schemas, check for orphan references — this is the foundation for the broader "asset guardrails" theme.
Parent
#32 (asset pipeline migration milestone)
Problem
Future non-tech contributors will add images by dragging files into the repo (or via the planned content-authoring skills). Expecting them to run
pnpm install && node scripts/optimize-assets.js --writelocally is a non-starter — they don't have Node, won't remember the step, and a missed run silently bloats the new blob store.Manual compression doesn't scale. The repo needs a guardrail.
What to build
GitHub Action that runs on every PR touching
posts/assets/**:actions/checkoutwithpersist-credentials+ a PAT, or the built-inGITHUB_TOKENconfigured withcontents: writeandpull-requests: write)pnpm installnode scripts/optimize-assets.js --write(the generalised script from the sibling follow-up feat(assets): generalise compression script across all asset categories #45)chore(assets): auto-compress images [skip ci], pushOptional but valuable:
[ci skip-compression]flag in PR body to bypass (escape hatch for intentional high-fidelity originals)node_modulesto keep the action fastAcceptance criteria
.github/workflows/optimize-assets.ymlexists, triggers onpull_requestpaths matchingposts/assets/**[ci skip-compression]in PR body bypasses the action[skip ci]or a path-based guard)Blocked by
optimize-assets.js— no point wiring CI around a script that only handlesteam/)Notes
DX follow-up from #41 — companion to #45. Together they form the non-tech contributor flow: drag image into PR → CI compresses + commits back → reviewer sees the cleaned diff. No local Node setup required.
Same approach could later be extended to: lint frontmatter, validate Zod schemas, check for orphan references — this is the foundation for the broader "asset guardrails" theme.