ci: check a pull request against the base it merges into

Merged
M4
4h ago
+5-6

Package

None, this changes CI only.

Changes

Lint's Check versions and Check one package per pull request steps diffed the checkout against github.event.pull_request.base.sha. The checkout is the pull request merged into the base branch, but base.sha can be an older commit. When a pull request is behind main, main's newer commits then count as part of the pull request.

#72 hit this. Its branch started at f76309e, main had since merged #64, and Lint failed with This pull request changes 2 packages: dev-servers, openvpn-connect although #72 only touches dev-servers.

Both steps now pass HEAD^1, the merge commit's first parent, which is the base the pull request merges into. The version check also reads earlier versions from that base, so it compares against everything main has published, not only what was there when the branch started.

Access

None.

Testing

  • Checked out #72's merge commit 0322c4e (parents 9e736a4 and 3fa9d69), the one CI ran on. ./scripts/check-one-package.sh f76309e reproduces the failure. ./scripts/check-one-package.sh HEAD^1 and ./scripts/check-versions.sh HEAD^1 pass.
  • Merged a change to dev-servers that keeps version 1.0.2 into main with --no-ff. ./scripts/check-versions.sh HEAD^1 still fails with packages/dev-servers changed but is still version 1.0.2.
  • actionlint passes on ci.yml.
  • Merges cleanly with #78, which also changes ci.yml.

Claude Opus 5.5 via Claude Code


Summary by cubic

Fixes the CI version and one-package checks so they diff against the base the pull request actually merges into instead of base.sha, which can be older and caused main's newer commits to count as part of the pull request.

  • Both lint steps now pass HEAD^1, the merge commit's first parent, which is the base branch the pull request merges into.
  • The version check also reads previously published versions from that base, so it compares against everything main has published, not only what existed when the branch started.

Summary by CodeRabbit

  • Chores
    • Pull-request checks for version and package-count changes now compare against the pull request’s base commit, helping ensure their results reflect the correct changes. This update affects automated validation only; it does not change the application’s features or behavior.