GitHub Actions and CI gating
Run your golden flows on every pull request and branch push with reflow ci. Reflow executes only the flows affected by the diff, carries forward unaffected passing results, posts one live-updating summary comment as reflow-code-review[bot] with a linked review app, and gates the job on regressions.
What reviewers see on a pull request
Section titled “What reviewers see on a pull request”Each push updates one Change Summary comment from reflow-code-review[bot] instead of stacking new comments, linking every visual diff to a private team review page:
reflow-code-review[bot] · Reflow Change Summary (commit 8f3a1c2 vs. main)
Status Count Flows ──────────────────────────────────────────────────────────────────── ✖ new_failure 1 checkout-apply-coupon (step 3/4 failed) △ snapshot_changed 1 team-invitation (role selector removed) ✔ fixed 1 billing-invoice-pdf ✔ passed 14 (11 borrowed from main · 3 executed)
Full report (private team review app): https://app.reflow.io/acme/review-apps/ci-pr-42
Gate: reflow ci gate -> exit 1 (1 new_failure)Quickstart workflow
Section titled “Quickstart workflow”Commit .reflow/app.yml at the repository root to bind the checkout to one team and collection:
team: <team UUID>collection: <collection UUID>repository: owner/name # optional; the checkout's GitHub remotes must matchreflow ci, reflow plan, reflow apply, and local MCP execution tools enforce .reflow/app.yml whenever it exists, refusing runs whose signed-in team or collection differs.
Then run the public Reflow CLI from any GitHub Actions workflow. Check out with fetch-depth: 0 so Git history includes the pull request base commit:
name: Reflow CIon: pull_request: push: branches: [main]
jobs: reflow: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0
# Install Reflow CLI, start your application under test, and write # private plugin bindings to $REFLOW_BINDINGS_FILE outside the checkout.
- name: Initialize plugins and target run: | reflow init --collection "$REFLOW_COLLECTION_ID" --lockfile-readonly reflow target http://127.0.0.1:3000 \ --group "pr-${GITHUB_RUN_ID}" \ --collection "$REFLOW_COLLECTION_ID" \ --scope device \ --bindings "$REFLOW_BINDINGS_FILE"
- name: Describe the CI context if: github.event_name == 'pull_request' run: | jq '{provider: "github-actions", repository: .repository.full_name, branch: .pull_request.head.ref, pr_number: .pull_request.number, base_sha: .pull_request.base.sha, run_url: "\(env.GITHUB_SERVER_URL)/\(env.GITHUB_REPOSITORY)/actions/runs/\(env.GITHUB_RUN_ID)"}' \ "$GITHUB_EVENT_PATH" > "$RUNNER_TEMP/ci.json"
- name: Run affected golden flows run: reflow ci run --golden --base-branch main --ci-context "$RUNNER_TEMP/ci.json"
- name: Publish report and update PR comment if: ${{ !cancelled() }} run: reflow ci report --base-branch main --format markdown --post >> "$GITHUB_STEP_SUMMARY"
- name: Gate on regressions run: reflow ci gateInitialize the application’s plugin selection on a trusted developer machine first. Plugin versions live in Reflow’s collection lock—no lock file is committed—and --lockfile-readonly ensures CI installs that exact pinned selection without modifying it.
Run reflow ci report --post with if: ${{ !cancelled() }} so the PR comment updates even when reflow ci run exits 1 on a failing flow. Keep reflow ci gate as the dedicated gating step. --post requires no id-token permission.
Connect the Reflow GitHub App
Section titled “Connect the Reflow GitHub App”Reflow posts and updates one Change Summary comment per pull request as reflow-code-review[bot], keeping screenshots behind a private team review page link. Comment posting is off until a team owner or admin enables it:
- Open Code review in the Reflow dashboard.
- Install the Reflow GitHub App or connect an existing installation on repositories you administer.
- Link each repository to its Reflow collection.
- Set post comments to must be asked or automatically (a CI workflow running
--postcounts as asked).
How ci run, ci report, and ci gate work
Section titled “How ci run, ci report, and ci gate work”| Command | Role | Key options |
|---|---|---|
reflow ci run | Executes golden flows affected by the diff, carries forward unaffected passing results, and records one CI run in Reflow. | --golden, --base-branch <name>, --ci-context <file>, --since auto, --label <tag>, --parallelism <n> |
reflow ci report | Compares the CI run against its baseline CI run, classifies every flow transition and snapshot diff, optionally publishes a private review page, and posts/updates the PR comment. | --base-branch <name>, --format markdown, --publish, --post |
reflow ci gate | Fails the job when any flow lands in a gated failure class. | --fail-on <classes> |
Execution and borrowing (ci run)
Section titled “Execution and borrowing (ci run)”- Diff selection: On a pull request,
ci runcompares against the context file’sbase_sha; on branch pushes, against the last CI run on that branch (--since auto). Any flow that has never passed or whose steps changed runs regardless ofcovers. - Base-branch borrowing: On pull requests,
--base-branch <name>lets an unaffected flow with no PR-branch result borrow the passing result from that branch’s CI run atbase_sha(or its newest ancestor) when that run executed the flow’s current version. The summary names the borrowed CI run. - Filtering:
--label <tag>restricts execution to golden flows whose frontmattertagslist includes<tag>. - Context JSON:
--ci-contextacceptsprovider(required) plus optionalrepository(owner/name),branch,pr_number,base_sha(40-hex commit SHA), andrun_url(https://). Omit null fields on non-PR events (or omit--ci-contexton pushes, whererepository:falls back to.reflow/app.yml). - Fail-closed recording: If any required flow fails to produce a run (for example, an uncertain apply), no CI run is recorded and
ci runexits 1 soci reportandci gatefail cleanly rather than reading a stale run.
Classification, review page, and PR comment (ci report)
Section titled “Classification, review page, and PR comment (ci report)”ci report compares each flow against its counterpart in the baseline CI run (Reflow stores no approved screenshot baseline) and classifies transitions as new_failure, still_failing, fixed, passed, unknown, new_flow, removed_flow, or not_run. Named Browser snapshots pair by step name and snapshot name.
--publish: Publishes a private team review app containing the summary, every flow grouped by transition, and before/after comparisons for up to 12 changed checkpoint images with changed-text excerpts, printingFull report: <url>on the last line. The CI review page is always private to the team.--post: Publishes the private review page and posts or updates thereflow-code-review[bot]PR comment, printingPosted to the pull request: <url>orNot posted: <why>.
--post exit behavior
Section titled “--post exit behavior”| Exit code | When it occurs |
|---|---|
0 | Comment posted/updated, or skipped cleanly because comments are disabled for the team/repository, the repository is unlinked or the GitHub App is uninstalled, the run is not for a pull request (for example a push to main), the PR is from a fork, another run is actively posting, the PR has a newer commit, GitHub rate-limited the request, or the report exceeds comment limits (2,000 flows or 500,000 bytes). |
1 | Write outcome is uncertain, GitHub or Reflow is unreachable, the token lacks permission, the CI run is missing, the report could not be built, or the review page failed to publish. |
Gating merges (ci gate)
Section titled “Gating merges (ci gate)”By default, reflow ci gate exits 1 if any flow lands in new_failure, still_failing, unknown, or not_run:
| Transition / signal | Meaning | Default ci gate |
|---|---|---|
new_failure | Passed on baseline, failed on head. | Fail (exit 1) |
still_failing | Failed on both baseline and head. | Fail (exit 1) |
unknown | Uncertain or incomplete execution outcome. | Fail (exit 1) |
not_run | Required golden flow produced no result or borrowed run. | Fail (exit 1) |
snapshot_change | Retained checkpoint image or text differs from baseline. | Pass (exit 0; opt in via --fail-on) |
fixed / passed / new_flow / removed_flow | Passing or lifecycle transitions. | Pass (exit 0) |
Override classes with --fail-on:
- Allow known failures while blocking regressions:
reflow ci gate --fail-on new_failure,unknown,not_run - Gate on visual checkpoint changes as well:
reflow ci gate --fail-on new_failure,still_failing,unknown,not_run,snapshot_change
Branch protection rules determine which GitHub checks block merging. Run reflow help ci for every flag.
Agent-authored PR code reviews
Section titled “Agent-authored PR code reviews”To let your coding agent post structured code reviews, keyed inline diff comments, and thread replies as reflow-code-review[bot]—alongside the automated CI summary while keeping approvals human-only—see Pull request code reviews.
To comment from your own GitHub account instead of the bot, use the gh CLI (see the pr-publishing skill).
Use a test collection
Section titled “Use a test collection”Every CI run targets a collection so repository-checked-in flows and flows stored in Reflow execute together. Pass the same collection ID to reflow init and reflow target (or commit .reflow/app.yml); subsequent commands read it from the job’s private profile. See Test storage for collection creation and repository registration.
For non-golden or custom CLI runs outside reflow ci, invoke plan and apply directly:
reflow init --collection <collection-id> --lockfile-readonlyreflow target http://127.0.0.1:3000 --group app-ci --collection <collection-id> --scope device \ --bindings "$REFLOW_BINDINGS_FILE"reflow planreflow apply --parallelism 4 --result-file "$RUNNER_TEMP/reflow-apply.json"applywrites progress to stderr and a final summary to stdout;--result-filecaptures the structured receipt.--parallelismoverlaps independent flows within dependency and device limits.- Use an isolated profile and fresh application state per job; changing
targetstarts a clean execution session.
Add knowledge and review notes
Section titled “Add knowledge and review notes”For structured base-vs-head change comparisons with knowledge patches and independent agent review notes, follow the MCP preparation workflow (prepare_comment and export_comment).
Appendix: custom two-job artifact export
Section titled “Appendix: custom two-job artifact export”Teams integrating directly with the Reflow source repository’s custom Actions (gh-action/action.yml, .github/actions/reflow-setup/action.yml, .github/actions/reflow-run/action.yml) can separate untrusted PR execution from comment publishing into two jobs:
- Execution job (read-only repo permissions): Runs PR code with
collection,cli-path,target-url,bindings-file, and optionalinputs-file, then exports an offline visual report (index.html+ local images) as a private 14-day GitHub Actions artifact. - Trusted publisher job: Reads the allowlisted artifact and updates one owned PR comment with a Download visual report link. Superseded publishers stop automatically on new pushes;
[skip ci]commits leave the current linked run intact.
Pin both actions to the same reviewed commit SHA and register the GitHub owner/name with collection-bind for default-branch historical sync.