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.
This commit is contained in:
Mohamed Boudra
2026-10-21 13:32:10 +07:00
committed by GitHub
parent 77453388e4
commit 98d34a3dc1
4 changed files with 18 additions and 6 deletions
+1 -1
View File
@@ -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:
-1
View File
@@ -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/**"
+4 -3
View File
@@ -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.
+13 -1
View File
@@ -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"]) {