Skip to content

Report the shot at the commit that has a branch - #190

Merged
abernier merged 2 commits into
mainfrom
chromatic-head-sha
Aug 13, 2026
Merged

Report the shot at the commit that has a branch#190
abernier merged 2 commits into
mainfrom
chromatic-head-sha

Conversation

@abernier

Copy link
Copy Markdown
Member

Groundwork for adding UI Tests to the branch ruleset. It cannot be added today: the status never reaches the commit a required check is read from.

Chromatic posts UI Tests and UI Review on whatever commit the CLI is handed, and on a pull_request event that is GITHUB_SHA -- the merge commit GitHub builds for the run, a commit that exists on no branch. GitHub Actions, by contrast, reports its check runs on the head commit. Measured on #187, they never meet:

$ gh api repos/pmndrs/examples/commits/5520f5f2/check-runs --jq '.total_count'   # head
12
$ gh api repos/pmndrs/examples/commits/5520f5f2/status --jq '.statuses | length'
0

$ gh api repos/pmndrs/examples/commits/aefcbe4/status --jq '.statuses[] | "\(.context)\t\(.state)"'   # merge commit
Test suite publish  success
UI Tests            pending
UI Review           pending

The pull request shows all of them together -- GitHub knows the merge commit is its -- so nothing looks wrong until you make one of them required, at which point every pull request waits forever on a status that lands somewhere else.

So hand Chromatic the head commit explicitly, 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.

After this merges

  1. Re-run chromatic-job on an open pull request and check the status lands on the head:
    gh api repos/pmndrs/examples/commits/$(gh pr view 187 --json headRefOid --jq .headRefOid)/status \
      --jq '.statuses[] | "\(.context)\t\(.state)"'
  2. Only then add UI Tests to the Basic ruleset as a required status check.

馃 Generated with Claude Code

abernier and others added 2 commits August 13, 2026 17:39
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 <noreply@anthropic.com>
`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 <noreply@anthropic.com>
@abernier
abernier merged commit b64e055 into main Aug 13, 2026
15 checks passed
@abernier
abernier deleted the chromatic-head-sha branch August 13, 2026 15:49
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