Repository navigation
feat(pr-gate): never a draft, only the top of a stack, only what it changes - #32
Merged
Merged
Conversation
… top, Rush impact A composite action, pr-gate/, decides whether a pull request's checks run: never on a draft; in a stack, only on the top PR (its tree holds every PR below it); and, given Rush projects or paths, only when the stack changes them, by Rush's own --impacted-by from where the stack left its root branch. It fails open. Every reusable workflow takes it as `pr-gate: true`, off by default, so moving v2 changes no caller (pr-gate/PR-GATE.md, PG-D1 to PG-D7). - app-ci: gate in `plan` (the project's impact, or gate-paths); `checks` skips. - library-ci: a `gate` job; the environment and the package diff come from the stack's root, so a stack's top PR runs with dev's secrets. - docs-pages: a `gate` job for pull requests; deploy and package spell out their status, since the skipped gate would otherwise stop every publish. - db-migrations-pr: the database project's impact plus gate-paths. - infra-diff: top-only with gate-paths, else every ready PR. - No reusable workflow names pull-requests: read (asking for more than a caller grants fails it); workflow-wide permissions moved to the jobs. - Caches are restored on a PR and saved only off one; rush-cache.yml saves the one every PR reads, from the default branch, under the checks' keys. - cli: BE_NPM_CHECK probes ONE @beplus package (one request) instead of each dependency (71 in bepluscloud's console, about a minute of every run). - test/pr-gate/run.sh + test-pr-gate.yml: 20 decisions against a fake gh. Co-Authored-By: Igor Lamos <igor@be.plus>
igorlamos
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The PR gate (
pr-gate/, design inpr-gate/PR-GATE.md, PG-D1–D7) decides inside each run whether a pull request's checks run. A skipped check reports "skipped", with the reason in the run summary.ready_for_review) starts the checks.rush list --impacted-by git:<fork point>(lockfile included, project by project) orgate-pathsglobs, read over the whole stack's diff from its root branch.rush.json, Rush config,common/scripts.pull-requests: read, or when Rush can't answer, the checks run, with a warning.Reusables:
app-ci,library-ci,docs-pages,db-migrations-prandinfra-difftakepr-gate: true(andgate-pathswhere that makes sense).v2changes no caller.permissionsmoved onto the jobs: a called workflow cannot ask for more than its caller grants.Also:
app-ci,library-cianddb-migrations-prrestore the Rush/pnpm cache on a PR and save it only off one. The new reusablerush-cache.ymlsaves the one cache they all read, from the default branch.cli:BE_NPM_CHECKprobes one @beplus package instead of every one, so the job only proves the token arrived; install fails loudly if a package is missing.Why
Measured on bepluscloud/ai, Nov 5–16: about 47% of console-CI minutes ran on PRs lower in a stack, or on PRs that don't touch the console. The libraries had the opposite problem:
branches: [dev]let a stack's bottom PR run and never its top. Across the Enterprise, Nov 1–16 came to $186 at list price.Tests
test/pr-gate/run.sh: 20 cases against a fakeghand a temporary git repo, all passing; it runs intest-pr-gate.yml.scripts/verify-callers.mjswas updated so the gate job is not reported as a regression.After merge
Tag
v2.17.0and movev2. Merge the callers only after that (bepluscloud/ai, 50beplus/*libraries, MRKIT, Mountaineer); until thenpr-gateis an unknown input to them.