All posts
Development Log 2 min read

Your PR passed CI. Which version of main did it test?

Two changes can pass on their own and fail together. Before merging, check the commit CI tested and whether it includes the current target branch.

Say one PR reorganizes the navigation and another adds a browser test that opens an item in the old menu. The second PR’s test passes against the old layout. The first PR merges, then the second follows. Now the test fails on main. Each PR looked fine from the branch where it was tested.

Check what CI tested

  1. Open the required check, then confirm the SHA in the workflow’s checkout step. GitHub can show checks on the PR head or a test merge commit, and the workflow can override what it checks out. GitHub’s merge branch guide
  2. See whether that commit includes the current tip of the target branch. Use a local checkout of that exact commit with full history. With main as the target, you can check the ancestry directly.
git fetch origin main &&
  git merge-base --is-ancestor FETCH_HEAD HEAD

Exit status 0 means the fetched main is in the tested history. Exit status 1 means it’s absent. Refresh the merge candidate and rerun the required checks. Git merge-base manual

If the base moves frequently, GitHub’s up-to-date branch requirement or a merge queue can make that check part of the merge workflow. GitHub’s branch protection guide

How Autop checks the base before merging

A layout change in the Autop console merged ahead of a PR whose green checks came from the older base. When the second PR merged, its shell test failed against the new layout on main.

Autop now does its own base comparison before attempting an automatic merge. If the head is stale, Autop holds the merge and requests a branch update. The refreshed head goes through CI and review. This gives the browser test a chance to catch the layout change while the work is still in a PR.

Topics

Get new posts by email