From f7ecef4b959feab7ad98785ab6a484a774fb0839 Mon Sep 17 00:00:00 2001 From: John Travers Date: Sun, 15 Nov 2026 23:07:28 +0000 Subject: [PATCH] ci: diff a pull request against its merge commit's first parent The changes job diffed against the event's pull_request.base.sha, which can lag behind main: it stayed at 281a9543 on #847 after #845 merged, so #845's ci.yml and native/ changes were counted as #847's own and the docs-only PR ran every lane. The checkout is GitHub's merge of the head into main's current tip, so its first parent is the right base. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f430f0d1..a183af091 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,13 @@ jobs: REPO: ${{ github.repository }} run: | lanes=full + # A pull request's checkout is GitHub's merge of its head into the base branch's + # current tip, its first parent. The event's base.sha can be older than that tip + # (it does not follow later pushes to main), and a diff against it would count + # whatever main merged since as the pull request's own change. + if [ "$EVENT" = pull_request ] && git rev-parse -q --verify HEAD^2 > /dev/null; then + BASE=$(git rev-parse HEAD^1) + fi if [ -n "$BASE" ] && git cat-file -e "$BASE^{commit}" 2>/dev/null; then git diff --name-only "$BASE" HEAD > changed.txt cat changed.txt