Aller au contenu

Chromatic label

Do not start unless the current request names this skill or asks to add the chromatic label. Opening a PR, or a diff that can move pixels, is not that request.

storybook-chromatic.yml runs on a PR only when the chromatic label is added. Each run bills snapshots, so the label goes on a PR whose diff can move pixels, and nowhere else.

Procedure

  1. Read the PR labels. chromatic already there → stop. Never remove it: removing then re-adding it starts a second run.
  2. Fetch the base branch, then list the candidates from the repo root, PR head checked out:
git fetch origin <base-branch>
.cursor/skills/chromatic-label/chromatic-label-reasons.sh origin/<base-branch>

Output: one <reason>\t<path> line per file. Empty output → stop, no label, no comment.

Reason Matches
story a .stories.tsx
design-system uimmo src/, theme src/, projects/storybook/.storybook/
classname an app .tsx whose diff touches className, rendered by a story within 4 imports

Ignored: i18n JSON (untraced in the Chromatic workflow), API, .md, .mdc, tests. 3. Read the diff of each story and classname line. Drop a line when the change cannot move a pixel: imports, types, comments, renames, or the same classes reordered. Keep every design-system line. 4. No line left → stop. Otherwise add the label once and post one comment, in French:

gh pr edit <number> --add-label chromatic
Label `chromatic` posé : ce diff peut changer des snapshots Storybook.

- `story` — `projects/.../Foo.stories.tsx`
- `classname` — `projects/.../Bar.tsx`

Automation setup

  • Trigger: GitHub "Pull request opened" (also fires when a draft is marked ready). Not "Pull request pushed": later commits do not restart Chromatic, the workflow ignores synchronize.
  • Prompt: Apply .cursor/skills/chromatic-label/SKILL.md to this pull request. Naming this file is the explicit request; the agent opening the PR does not run the skill.
  • Secret GH_TOKEN: fine-grained token, Pull requests: write on this repo. A label added with a workflow GITHUB_TOKEN does not trigger other workflows, so Chromatic would never start.