From 89996d01940f6d2ec7fc406fe8ac81f1cfcafbc9 Mon Sep 17 00:00:00 2001 From: Vishwanath Raman Date: Tue, 24 Nov 2026 13:30:02 -0800 Subject: [PATCH] fix(ci): diff the PR head in the SDK freeze checks The Python and TypeScript SDK freeze checks ran `git diff BASE_SHA...HEAD`, where HEAD is the merge commit that actions/checkout creates for a pull_request event. The recorded pull_request.base.sha does not move when main advances, so on a long-lived PR the diff included every change main made after that base, and the checks failed PRs that never touched the SDKs. Diff against pull_request.head.sha instead. The merge-base of the recorded base and the PR head is the PR's real fork point, so only the PR's own changes are checked. Signed-off-by: Vishwanath Raman --- .github/workflows/branch-checks.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/branch-checks.yml b/.github/workflows/branch-checks.yml index 5d6ac0d0fd..4599657ae3 100644 --- a/.github/workflows/branch-checks.yml +++ b/.github/workflows/branch-checks.yml @@ -649,9 +649,13 @@ jobs: - name: Reject changes to the Python SDK env: BASE_SHA: ${{ github.event.pull_request.base.sha }} + # Compare against the PR head, not the checked-out merge commit: the + # recorded base SHA can lag main, and diffing the merge commit would + # then report main's own changes as the PR's. + HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | set -euo pipefail - changed=$(git diff --name-only --diff-filter=d "${BASE_SHA}...HEAD" -- \ + changed=$(git diff --name-only --diff-filter=d "${BASE_SHA}...${HEAD_SHA}" -- \ python \ tasks/scripts/generate_python_proto.py) if [ -z "$changed" ]; then @@ -695,11 +699,13 @@ jobs: - name: Reject changes to the TypeScript SDK env: BASE_SHA: ${{ github.event.pull_request.base.sha }} + # See the Python SDK freeze: diff the PR head, not the merge commit. + HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | set -euo pipefail # The package is a stub that re-exports @ai-openshell/sdk. Its files stay # editable so the stub and its moved notice can be maintained. - changed=$(git diff --no-renames --name-only --diff-filter=d "${BASE_SHA}...HEAD" -- sdk/typescript \ + changed=$(git diff --no-renames --name-only --diff-filter=d "${BASE_SHA}...${HEAD_SHA}" -- sdk/typescript \ ':(exclude)sdk/typescript/package.json' \ ':(exclude)sdk/typescript/README.md' \ ':(exclude)sdk/typescript/index.js' \