From 98d34a3dc1105eb0f1b1a528cba1d067dd5fa9f1 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Wed, 21 Oct 2026 13:32:10 +0700 Subject: [PATCH] ci: run pull-request checks for every base branch (#7545) Stacked PRs and PRs into next got no CI because the pull_request trigger was limited to main. Drop the base filter from CI and desktop packaging, and lock it with a workflow contract test. --- .github/workflows/ci.yml | 2 +- .github/workflows/desktop-packages.yml | 1 - docs/release.md | 7 ++++--- scripts/ci-workflow.test.mjs | 14 +++++++++++++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c2a397170..486c7333b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,8 @@ name: CI on: push: branches: [main] + # Every base branch, so stacked PRs and PRs into `next` get the same checks. pull_request: - branches: [main] merge_group: workflow_dispatch: diff --git a/.github/workflows/desktop-packages.yml b/.github/workflows/desktop-packages.yml index c30eea7da4..77e2735c6a 100644 --- a/.github/workflows/desktop-packages.yml +++ b/.github/workflows/desktop-packages.yml @@ -6,7 +6,6 @@ on: # Packaging leaves ordinary PR CI, but a PR that changes what gets packaged # or how it is smoked still proves the real artifacts before merge. pull_request: - branches: [main] paths: - "packages/desktop/**" - "plugins/**" diff --git a/docs/release.md b/docs/release.md index 751998c864..c6ba97e078 100644 --- a/docs/release.md +++ b/docs/release.md @@ -62,9 +62,10 @@ release. This applies to both beta and stable releases. the changelog. Retarget remaining PRs based on `next` to `main` and delete the integrated `next`. Create it fresh when needed again. -**Setup still needed:** CI, Docker, and Nix PR checks currently target only `main`, -and GitHub permits only squash merges. Enable checks and required-check protection -for `next`, CI on its pushes, and merge commits for the integration PR. Handle PR +**Setup still needed:** PR checks run for every base branch, but CI, Docker, and Nix +push runs target only `main`, and GitHub permits only squash merges. Enable +required-check protection for `next`, CI on its pushes, and merge commits for the +integration PR. Handle PR base changes (`edited` events) so retargeting runs checks against the new base; GitHub's default PR events do not cover this. Deployment triggers stay unchanged. diff --git a/scripts/ci-workflow.test.mjs b/scripts/ci-workflow.test.mjs index 50d2ab448b..6fa13ba0ec 100644 --- a/scripts/ci-workflow.test.mjs +++ b/scripts/ci-workflow.test.mjs @@ -105,6 +105,18 @@ test("gated checks are statically named jobs with real job-level gating", () => } }); +test("pull-request checks run for every base branch, including stacked PRs", () => { + for (const workflowPath of [ + ciWorkflowPath, + new URL(".github/workflows/desktop-packages.yml", repoRoot), + ]) { + const trigger = readFileSync(workflowPath, "utf8").split("jobs:", 1)[0]; + const pullRequest = trigger.match(/^ pull_request:\n((?: .*\n)*)/m); + assert.ok(pullRequest, `${workflowPath.pathname} runs on pull requests`); + assert.doesNotMatch(pullRequest[1], /branches/); + } +}); + test("change gating allows superseded workflow runs to cancel", () => { const ci = readFileSync(ciWorkflowPath, "utf8"); assert.match( @@ -308,7 +320,7 @@ test("desktop packaging smokes main pushes and only the pull requests that touch const source = readFileSync(new URL(".github/workflows/desktop-packages.yml", repoRoot), "utf8"); const trigger = source.split("jobs:", 1)[0]; assert.match(trigger, /push:\s*\n\s+branches: \[main\]/); - assert.match(trigger, /pull_request:\s*\n\s+branches: \[main\]\s*\n\s+paths:/); + assert.match(trigger, /pull_request:\s*\n\s+paths:/); assert.match(trigger, /- "packages\/desktop\/\*\*"/); assert.doesNotMatch(source, /dorny\/paths-filter/); for (const action of ["actions/checkout", "actions/setup-node", "actions/upload-artifact"]) {