From 1b10939054e5a14bcb569f00837a0b89bbffd163 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Thu, 13 Aug 2026 17:39:59 +0200 Subject: [PATCH 1/2] Report the shot at the commit that has a branch Chromatic posts `UI Tests` and `UI Review` on whatever commit the CLI is given, and on a `pull_request` event that is `GITHUB_SHA` -- the merge commit GitHub builds for the run, which exists on no branch. The pull request displays them anyway, so nothing looked wrong. But a required status check is read off the head commit, and on #187 the two sets never met: twelve Actions check runs on `5520f5f2`, three Chromatic statuses on the merge commit `aefcbe4`. Adding `UI Tests` to the ruleset today would have waited for a status that never lands there, on every pull request, forever. So hand Chromatic the head commit, plus the branch and slug that have to travel with it or the build attaches to the wrong ref. All three are empty on a push, where `GITHUB_SHA` is already the commit itself. Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42d1007c..a98b535c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -191,10 +191,26 @@ jobs: # times, and the nightly is what keeps asking. Chromatic answers "should # this have changed?", which only makes sense once the answer to "did # anything change by itself?" is no. + # + # `CHROMATIC_SHA`, and the branch and slug that have to travel with it, + # because on a `pull_request` event `GITHUB_SHA` is the *merge* commit + # GitHub builds for the run -- a commit that exists on no branch. Left + # alone, Chromatic posts `UI Tests` and `UI Review` there, where the pull + # request shows them (GitHub knows the merge commit is its) but a + # required status check cannot: those are read off the head commit, + # which is where every Actions job already reports. Measured on #187: + # twelve check runs on `5520f5f2`, three Chromatic statuses on the merge + # commit `aefcbe4`, no overlap. + # + # Empty on a push, where `GITHUB_SHA` is already the commit itself. + # - run: pnpm chromatic ${{ github.ref == 'refs/heads/main' && '--auto-accept-changes' || '--exit-zero-on-changes' }} if: ${{ env.CHROMATIC == 'true' }} env: CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} + CHROMATIC_SHA: ${{ github.event.pull_request.head.sha }} + CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref }} + CHROMATIC_SLUG: ${{ github.event.pull_request.head.repo.full_name }} # # Build From 66b41bc85c78aba5dc257a9410b157ccdebe4654 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Thu, 13 Aug 2026 17:43:37 +0200 Subject: [PATCH 2/2] Take the documented values, fallbacks and all `github.repository` rather than the head repo's slug, and a fallback on each so a push to main keeps reporting where it always did. This is the snippet Chromatic's GitHub Actions guide gives for `pull_request` workflows, which is what this one is. Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a98b535c..497fbf4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,15 +202,23 @@ jobs: # twelve check runs on `5520f5f2`, three Chromatic statuses on the merge # commit `aefcbe4`, no overlap. # - # Empty on a push, where `GITHUB_SHA` is already the commit itself. + # It also picks the wrong baseline. That merge commit has the latest + # build on main for an ancestor -- the pull request's own branch does + # not -- so every comparison is made against main rather than against + # what this branch last looked like. + # + # Chromatic's own answer is to run this on `push` instead, which for + # this workflow would mean the whole 20-minute sweep on every branch + # push, pull request or not. So: the documented alternative, verbatim, + # falling back to the push values on main. # - run: pnpm chromatic ${{ github.ref == 'refs/heads/main' && '--auto-accept-changes' || '--exit-zero-on-changes' }} if: ${{ env.CHROMATIC == 'true' }} env: CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - CHROMATIC_SHA: ${{ github.event.pull_request.head.sha }} - CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref }} - CHROMATIC_SLUG: ${{ github.event.pull_request.head.repo.full_name }} + CHROMATIC_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} + CHROMATIC_SLUG: ${{ github.repository }} # # Build