Skip to content

ci(chromatic): skip snapshots on docs-only changes + Dependabot PRs#85

Merged
dgraciac merged 2 commits into
mainfrom
ci/reduce-chromatic-quota
May 12, 2026
Merged

ci(chromatic): skip snapshots on docs-only changes + Dependabot PRs#85
dgraciac merged 2 commits into
mainfrom
ci/reduce-chromatic-quota

Conversation

@dgraciac
Copy link
Copy Markdown
Member

Summary

Cuts Chromatic snapshot-quota burn on changes that cannot affect visual output. Two filters added to the existing workflow:

  1. `paths-ignore` skips Chromatic when the only modified files are markdown, changelogs, changesets, the dependabot config, or the auto-merge workflow. None of these reach the published bundle or any story.

  2. Top-level `if: github.actor != 'dependabot[bot]'` skips Chromatic on Dependabot-authored PRs. The auto-merge workflow already covers low-risk dev-dep bumps; running Chromatic on every patch of `vite` / `eslint` / `prettier` / etc. spends ~67 snapshots per PR × 2 (PR + merge to `main`) without ever changing pixels. Major bumps still get a manual review where the maintainer can run Chromatic locally if a visual check is warranted.

Why now

Free tier quota was exhausted this month. Without these filters every Dependabot patch bump (chromatic itself bumping 16.6 → 16.7 → 16.9 over a fortnight, plus vite, eslint, ts-eslint, jsdom, …) compounds the spend on changes whose visual impact is provably nil.

Branch filtering (`push: [main]` + `pull_request: [main]`) was already in place — feature branches without a PR do not consume quota. The concurrency cancel-in-progress was already in place too. These additions hit the remaining two leaks I could identify.

What this does not do

  • Does not enable TurboSnap. The documented pharos-tokens-CSS-from-`node_modules/` problem is still real: TurboSnap diffs against git tree, and `node_modules/` is not in it; pharos-tokens releases that change `dist/styles.css` content without touching any git-tracked file would still produce stale snapshots. Re-enabling TurboSnap is tracked separately — the path forward is caching the pharos-tokens content hash in a git-tracked file (e.g. `.pharos-tokens.fingerprint` updated via a postinstall script and added to Chromatic's `externals` glob).

  • Does not change the rebuild behaviour on real story changes. Every push to a human-authored PR or to `main` still rebuilds all stories, same as today.

Quality

  • Workflow YAML parses cleanly (`python3 -c "import yaml; yaml.safe_load(...)"` passes).
  • Prettier clean.
  • No source files touched — pure CI config.

Test plan

  • CI on this PR runs Chromatic (the PR is human-authored, no `paths-ignore` match).
  • A subsequent docs-only commit on `main` (or a Dependabot patch) should not trigger a Chromatic build — verify via the Actions tab.

🤖 Generated with Claude Code

Cuts the snapshot quota burn on changes that cannot affect the visual
output. Two filters added:

1. `paths-ignore` skips Chromatic when the only modified files are
   markdown, changelogs, changesets, or the auto-merge workflow.

2. Top-level `if: github.actor != 'dependabot[bot]'` skips Chromatic
   for Dependabot-authored PRs. The auto-merge workflow already covers
   low-risk dev-dep bumps; running Chromatic on every patch of
   vite/eslint/prettier/etc. spends ~67 snapshots per PR × 2 (PR +
   merge to main) without changing pixels. Major bumps still get a
   manual review, where the maintainer runs Chromatic locally if a
   visual check is warranted.

TurboSnap stays off — the documented `pharos-tokens` CSS-from-
node_modules problem is still real. Tracking issue for re-enabling
TurboSnap once we cache the pharos-tokens content hash in a git-tracked
file is filed separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@chromatic-com
Copy link
Copy Markdown

chromatic-com Bot commented May 12, 2026

Warning

Testing paused

Monthly snapshot limit reached. Update your plan to get more snapshots and resume testing.

Reverts the `if: github.actor != 'dependabot[bot]'` clause introduced
in the previous commit. The path-based filter (`paths-ignore`) stays;
that's pure quota cleanup with zero behaviour change for human PRs.

Reason for the revert: the CTO would rather try TurboSnap first as
the primary quota saver. With TurboSnap reading a content-hash
`pharos-tokens` fingerprint (separate PR, in flight), a Dependabot
bump that does not change the fingerprint will already skip every
snapshot, and a bump that does change it still wants a visual check
— skipping all Dependabot PRs unconditionally would mask the latter
case. The two strategies aren't additive; pick TurboSnap and keep
Dependabot in the pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dgraciac dgraciac enabled auto-merge (rebase) May 12, 2026 22:23
@dgraciac dgraciac disabled auto-merge May 12, 2026 22:23
@dgraciac dgraciac merged commit fe8d049 into main May 12, 2026
8 of 10 checks passed
@dgraciac dgraciac deleted the ci/reduce-chromatic-quota branch May 12, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant