Skip to content

ci: skip PR runs when targeting a non-main base branch#426

Merged
jrusso1020 merged 2 commits intomainfrom
ci/skip-stacked-pr-runs
Apr 22, 2026
Merged

ci: skip PR runs when targeting a non-main base branch#426
jrusso1020 merged 2 commits intomainfrom
ci/skip-stacked-pr-runs

Conversation

@jrusso1020
Copy link
Copy Markdown
Collaborator

What

Adds branches: [main] to the pull_request: trigger of each workflow that runs on PRs:

  • ci.yml
  • regression.yml
  • windows-render.yml
  • docs.yml
  • catalog-previews.yml

One line added per file. PRs whose base is something other than main (typical for stacked PRs targeting another feature branch) no longer trigger these workflows.

Why

CI usage was saturated earlier today — partly from ~14 simultaneously-active Vance branches, partly from the general pattern of Graphite-stacked PRs triggering the full matrix (styles-a..g, fast, render-compat, hdr, Windows render, CodeQL) once per level of the stack. On a 5-PR stack that's 5× the CI work, most of which is redundant: once the bottom of the stack merges, the next PR rebases to main and re-runs anyway.

After this change:

Scenario Before After
PR targeting main Full CI Full CI (unchanged)
Stacked PR (base = another feature branch) Full CI No CI
Stacked PR rebased to main Full CI Full CI (re-fires on base change)
push to main Full CI Full CI (unchanged)

Paired with #425 (concurrency groups), this should take a meaningful bite out of the hosted-runner contention we saw this afternoon.

Tradeoffs

  • Con: Mid-stack PRs lose CI signal until they reach the top of the stack. For short stacks this is fine — the convention with stacked PRs is to land them quickly and rely on the final-in-stack CI. For long-lived stacks it could hide regressions longer.
  • Mitigation: contributors who want mid-stack signal can re-target a PR to main temporarily, or push changes to an ancestor to force the stack to merge-down.
  • The concurrency: groups from ci(regression): add concurrency group to cancel superseded runs #425 already cancel superseded runs within a single branch — so the combination is "cancel wasted runs on the same branch" + "don't open runs on stacked bases in the first place."

Not touched

  • publish.yml — already filters to branches: [main] on the pull_request: types: [closed] trigger.
  • CodeQL — default-setup configured in the org UI, not a repo YAML. If CodeQL on stacked PRs becomes noisy, it can be adjusted in repo settings.

Test plan

Once merged: the next stacked PR anyone opens (base ≠ main) should skip CI. A subsequent rebase to main will re-fire CI as expected.

Adds `branches: [main]` to the `pull_request:` trigger of each workflow
that runs on PRs (CI, regression, Windows render verification, Docs,
Catalog Previews). PRs whose base is something other than main — typical
for stacked PRs — no longer trigger these workflows.

On a 5-PR Graphite stack this turns 5× CI runs into 1× (when the tip
of the stack reaches main). When a child PR is rebased/promoted so its
base becomes main, CI fires as normal.

publish.yml and the default CodeQL setup are untouched: publish already
filters to main, and CodeQL is default-setup (org UI, not a repo YAML).
Same drive-by as #423. Renovate's config-migration PR #422 landed
unformatted (Renovate bot skips lefthook), so every PR branched from
current main fails `bun run format:check`. Whichever of #423 / #426
merges first cleans it up.
@jrusso1020 jrusso1020 merged commit 2e8e579 into main Apr 22, 2026
20 checks passed
@jrusso1020 jrusso1020 deleted the ci/skip-stacked-pr-runs branch April 22, 2026 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants