From 9864a27ff4931b166b378f6ac403298b1ffa82e0 Mon Sep 17 00:00:00 2001 From: "beplus-agent-claude[bot]" <300068699+beplus-agent-claude[bot]@users.noreply.github.com> Date: Mon, 16 Nov 2026 17:59:05 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20the=20PR=20gate=20=E2=80=94=20never=20a?= =?UTF-8?q?=20draft,=20and=20in=20a=20stack=20only=20the=20top=20PR?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setup-beplus's PR gate (pr-gate/PR-GATE.md, v2.17.0) decides inside each run whether a pull request's checks run: never on a draft (marking it ready starts them), and in a stack only on the top PR, whose tree holds every PR below it; the PRs below report "skipped". A stack merges in one go, so dev ends at the tree the top PR tested. - `pull_request` runs on opened, synchronize, reopened and ready_for_review, with no `branches:` filter: a stack's top PR is based on the PR below it, so the filter let only the BOTTOM PR run, never the one that holds the stack. - A `paths:` filter moved into the gate (`gate-paths`), which reads the whole stack's diff: the filter saw only the top PR's own commits. - library-ci and docs-pages take `pr-gate: true`; a job of this repository's own waits for a `gate` job, and where it read the PR's base it reads the stack's root (dev), so it claims dev's environment and secrets. Needs setup-beplus v2.17.0 (v2 moved): until then `pr-gate` is an unknown input. Co-Authored-By: Igor Lamos --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4853491..e19dc50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ name: CI on: pull_request: + types: [opened, synchronize, reopened, ready_for_review] workflow_call: permissions: @@ -15,7 +16,26 @@ concurrency: cancel-in-progress: true jobs: + gate: + # The PR gate (setup-beplus pr-gate/PR-GATE.md): never a draft, and in a stack only the top PR, + # whose tree holds every PR below it. Every job below waits for its answer; any other event runs. + name: PR gate + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + outputs: + run: ${{ steps.gate.outputs.run }} + root: ${{ steps.gate.outputs.root }} + steps: + - id: gate + uses: beplus/setup-beplus/pr-gate@v2 + with: + stack: top-only + test: + needs: gate + if: needs.gate.outputs.run == 'true' name: Test (${{ matrix.os }}) strategy: fail-fast: false @@ -32,6 +52,8 @@ jobs: - run: npm run test:host lint: + needs: gate + if: needs.gate.outputs.run == 'true' name: Lint runs-on: ubuntu-latest steps: @@ -39,10 +61,11 @@ jobs: - run: npm run lint version: - name: Version + needs: gate # Only a PR into dev cuts a release (stage and prod are fast-forwarded from it), so only there - # do the release rules apply. - if: github.event_name == 'pull_request' && github.base_ref == 'dev' + # do the release rules apply. A stack's top PR is into the PR below it: its root is dev. + if: needs.gate.outputs.run == 'true' && (github.event_name == 'pull_request' && (needs.gate.outputs.root || github.base_ref) == 'dev') + name: Version runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 @@ -50,5 +73,5 @@ jobs: fetch-depth: 0 - run: scripts/release/verify-version.sh pr "origin/${BASE_REF}" "${HEAD_REF}" env: - BASE_REF: ${{ github.base_ref }} + BASE_REF: ${{ (needs.gate.outputs.root || github.base_ref) }} HEAD_REF: ${{ github.head_ref }}