Skip to content

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.

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)

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 match

reflow 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 CI
on:
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 gate

Initialize 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.

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:

  1. Open Code review in the Reflow dashboard.
  2. Install the Reflow GitHub App or connect an existing installation on repositories you administer.
  3. Link each repository to its Reflow collection.
  4. Set post comments to must be asked or automatically (a CI workflow running --post counts as asked).
CommandRoleKey options
reflow ci runExecutes 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 reportCompares 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 gateFails the job when any flow lands in a gated failure class.--fail-on <classes>
  • Diff selection: On a pull request, ci run compares against the context file’s base_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 of covers.
  • 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 at base_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 frontmatter tags list includes <tag>.
  • Context JSON: --ci-context accepts provider (required) plus optional repository (owner/name), branch, pr_number, base_sha (40-hex commit SHA), and run_url (https://). Omit null fields on non-PR events (or omit --ci-context on pushes, where repository: 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 run exits 1 so ci report and ci gate fail 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, printing Full 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 the reflow-code-review[bot] PR comment, printing Posted to the pull request: <url> or Not posted: <why>.
Exit codeWhen it occurs
0Comment 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).
1Write 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.

By default, reflow ci gate exits 1 if any flow lands in new_failure, still_failing, unknown, or not_run:

Transition / signalMeaningDefault ci gate
new_failurePassed on baseline, failed on head.Fail (exit 1)
still_failingFailed on both baseline and head.Fail (exit 1)
unknownUncertain or incomplete execution outcome.Fail (exit 1)
not_runRequired golden flow produced no result or borrowed run.Fail (exit 1)
snapshot_changeRetained checkpoint image or text differs from baseline.Pass (exit 0; opt in via --fail-on)
fixed / passed / new_flow / removed_flowPassing 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.

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).

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:

Terminal window
reflow init --collection <collection-id> --lockfile-readonly
reflow target http://127.0.0.1:3000 --group app-ci --collection <collection-id> --scope device \
--bindings "$REFLOW_BINDINGS_FILE"
reflow plan
reflow apply --parallelism 4 --result-file "$RUNNER_TEMP/reflow-apply.json"
  • apply writes progress to stderr and a final summary to stdout; --result-file captures the structured receipt.
  • --parallelism overlaps independent flows within dependency and device limits.
  • Use an isolated profile and fresh application state per job; changing target starts a clean execution session.

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).

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:

  1. Execution job (read-only repo permissions): Runs PR code with collection, cli-path, target-url, bindings-file, and optional inputs-file, then exports an offline visual report (index.html + local images) as a private 14-day GitHub Actions artifact.
  2. 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.