Skip to content
Docsnext-evolve 0.9.0BlognpmSign in
Docs menu

Winner pull requests

When an experiment has a winner, Evolve can open a pull request in your GitHub repository that puts the winning variant into your code. You review and merge it like any other PR; Evolve never merges. Once the change is deployed, the experiment archives itself, so no finished test is left running and the winning copy lives in your code, not in a flag.

Winner pull requests are on the Growth and Enterprise plans and during the free trial.

#Connect your repository

Do this once per site:

  1. In the dashboard, open the site's Settings and find the GitHub card.
  2. Click Install the GitHub App and pick the account and the repository (or repositories) Evolve may use. The App asks for read and write access to contents and pull requests, and read access to metadata. Nothing else.
  3. Back in Settings, choose the Repository, the App folder if your Next.js app isn't at the repository root (monorepos only, for example apps/web), and the Base branch the PR should target. Click Connect repository.

#Promote a winner

On the experiment page, the Promote winner card appears once a variant is winning. Pick how the PR changes your code:

  • Set the winner's props on <Optimizable> (the default). The winning values replace the old ones in the props you pass to <Optimizable id="…">. The region stays wrapped, so you can test it again later.
  • Unwrap: render the plain component. Same change, then <Optimizable … component={Hero} props={…} /> becomes <Hero … />, and the optimizable() wrapper is removed where nothing else uses it.

Click Create PR. It usually opens within seconds. The PR's description has the results table (visitors, conversions, rate, lift and chance of being best per variant, plus each guardrail's verdict) and a link back to the experiment. It never contains visitor-level data. Promoting again while a PR is open updates that PR (Update PR) instead of opening a second one.

Create PR stays disabled, with the reason, when:

  • the winner is still waiting on a guardrail goal ("guardrails are still collecting data", with an estimate of when it unlocks),
  • the winner fails a guardrail,
  • control won (your code already has it), or the experiment ended without a winner,
  • the site's plan doesn't include winner PRs.

#When Evolve can't edit the code safely

Evolve changes only what it's certain about: one <Optimizable> with that literal id, and props written as an object or as a const that nothing else uses. It edits just those values and keeps the rest of each file's formatting. If the code has a shape it can't change with certainty (computed props, spreads, an id used in several places), it opens a PR with instructions instead: the file and line to change and the exact values, in the description and in a small file you delete once done. It never opens a PR with a broken change.

#After the merge

  • Merged: if the experiment was still running, it completes with the PR's variant, so every visitor gets the winner while your deploy goes out.
  • Deployed: when the new code serves its first page, the region registers with the winner's props as its control and the experiment archives itself. The card shows "archived the experiment" next to the PR.
  • Unwrap PRs remove the region, so it never registers again. Those experiments stay completed (serving the winner) until you archive them by hand.

Closing a PR without merging changes nothing; promote again whenever you're ready.

#Let autopilot open the PR

On a bandit with autopilot on, turn on Open PRs automatically on the experiment's Autopilot card. When a variant becomes ready to promote (it wins and passes every guardrail), autopilot opens the PR with the default change. It still never merges: a person reviews and merges every PR. The PR list marks these "opened by autopilot".