From 768dc46304433256254854b2256f30d40938c15f Mon Sep 17 00:00:00 2001 From: soyuka Date: Wed, 3 Jun 2026 14:10:51 +0200 Subject: [PATCH] ci(commitlint): check PR commits against PR base ref instead of default branch The workflow uses `actions/checkout@v6` on `pull_request_target` without a `ref:` argument. That defaults to the target repo's default branch (`main`), not the PR's base ref. The shell step then computes `merge-base HEAD pr_head` where HEAD is `main` and walks `rev-list` forward to pick the "first PR commit". Because `main` and `4.3` diverged long ago, the walk picks the oldest `4.3` commit since divergence rather than the actual first PR commit, making commitlint fail on every PR against `4.3` (currently flagging `fix(graphiql): ...` whose scope is not in `.commitlintrc`). Set `ref: ${{ github.event.pull_request.base.ref }}` on the checkout step so HEAD is the PR's actual base. The existing merge-base + rev-list logic is then correct. Fixes the commitlint check failing on every PR against 4.3 by flagging unrelated 4.3 commits. --- .github/workflows/commitlint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 7ef4e2c5d6..a7e7c5af0b 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -15,6 +15,7 @@ jobs: - uses: actions/checkout@v6 with: fetch-depth: 0 + ref: ${{ github.event.pull_request.base.ref }} - name: Fetch PR head run: git fetch origin pull/${{ github.event.pull_request.number }}/head:pr_head - name: Run commitlint