How to Add a Visual Review and Approval Gate in CI
Cloud visual tools post a PR status check, so marking that check as required blocks merges until a reviewer accepts the diffs in the tool UI.
Let the visual tool report a commit status, then add that check to the branch protection required checks so unaccepted diffs block the merge.
Steps
- Enable the tool integration so it posts a PR status.
- Open branch protection settings for the default branch.
- Add the visual check to required status checks.
- Reviewers accept or reject diffs in the tool UI.
Workflow
.github/workflows/ci.yml
jobs:
visual-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: npm ci
- run: npx chromatic --project-token=${{ secrets.CHROMATIC_PROJECT_TOKEN }} --exit-zero-on-changesGotchas
--exit-zero-on-changeskeeps the build green so the required status check, not the CLI exit code, gates the merge.- The status context name must match exactly in branch protection or the gate does nothing.
Related guides
How to Approve and Update Visual Baselines in CIUpdate visual baselines safely with a manually triggered workflow that regenerates snapshots and commits them…
How to Post a Visual Diff Comment on a Pull Request in CISurface visual test results on the pull request by posting a comment with a link to the diff report using act…