Gate PR Builder on the trigger-pr-builder label as a temporary workaround - #4292
Conversation
📝 WalkthroughWalkthroughThe PR builder workflow now responds to ChangesPull-request CI gating
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
df5c40d to
631cef2
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/pr-builder.yml (1)
509-538: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
test-integration'sifdoesn't checkbuild_samplesresult.
needsincludesbuild_samples, butif: ${{ always() && needs.build.result == 'success' }}(line 538, unchanged) never checksneeds.build_samples.result. Ifbuild_samplesfails whilebuildsucceeds,test-integration's 3-way matrix still runs — wasting runner time, contrary to this PR's stated goal.test-e2e(line 666) correctly checks both.♻️ Proposed fix
- if: ${{ always() && needs.build.result == 'success' }} + if: ${{ always() && needs.build.result == 'success' && needs.build_samples.result == 'success' }}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/pr-builder.yml around lines 509 - 538, Update the test-integration job’s if condition to require both needs.build.result and needs.build_samples.result to equal success, while preserving always() and the existing matrix execution behavior. Use the existing build and build_samples dependency names in the condition.
🧹 Nitpick comments (1)
.github/workflows/pr-builder.yml (1)
33-153: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftRepeated label-gating boolean is duplicated across ~10 jobs.
The same
contains(github.event.pull_request.labels.*.name, 'trigger-pr-builder') && (github.event.action != 'labeled' || ...)expression (with subtly inconsistentworkflow_dispatchhandling, as flagged above) is copy-pasted acrosspreflight,verify-mocks,lint,build,test-frontend-packages,test-frontend-gate-app,test-frontend-console-app,build_samples,test-integration-status, andcleanup-turbo-cache. Computing this once (e.g., as apreflightoutput, similar todocs-changed/powershell-changed) and having downstream jobs check that single output would eliminate this class of drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/pr-builder.yml around lines 33 - 153, Consolidate the repeated trigger-pr-builder label and event gating used by preflight, verify-mocks, lint, build, test-frontend-packages, test-frontend-gate-app, test-frontend-console-app, build_samples, test-integration-status, and cleanup-turbo-cache into one shared preflight output, including the intended workflow_dispatch handling. Define the boolean once in preflight alongside docs-changed and powershell-changed, then have each downstream job gate on that output while preserving merge_group behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-builder.yml:
- Around line 150-152: Update the lint job’s if condition to include
github.event_name == 'workflow_dispatch' as an unconditional execution path,
alongside the existing pull_request and merge_group conditions, so manual
dispatch runs execute backend/frontend lint.
- Around line 114-116: Update the verify-mocks job condition to include
workflow_dispatch alongside pull_request and merge_group, matching the preflight
condition so manual dispatch runs execute mock verification.
- Around line 37-39: Update the preflight job’s if condition to allow
github.event_name == 'workflow_dispatch' unconditionally, alongside the existing
pull_request label-gated and merge_group branches. Preserve the current pull
request label and action checks for pull_request events.
---
Outside diff comments:
In @.github/workflows/pr-builder.yml:
- Around line 509-538: Update the test-integration job’s if condition to require
both needs.build.result and needs.build_samples.result to equal success, while
preserving always() and the existing matrix execution behavior. Use the existing
build and build_samples dependency names in the condition.
---
Nitpick comments:
In @.github/workflows/pr-builder.yml:
- Around line 33-153: Consolidate the repeated trigger-pr-builder label and
event gating used by preflight, verify-mocks, lint, build,
test-frontend-packages, test-frontend-gate-app, test-frontend-console-app,
build_samples, test-integration-status, and cleanup-turbo-cache into one shared
preflight output, including the intended workflow_dispatch handling. Define the
boolean once in preflight alongside docs-changed and powershell-changed, then
have each downstream job gate on that output while preserving merge_group
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: df693a54-c588-49ca-9796-e3835c2adff2
📒 Files selected for processing (4)
.github/actions/setup-pnpm/action.yml.github/workflows/pr-builder.ymltests/e2e/package.jsontests/e2e/playwright.config.ts
631cef2 to
fe87742
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
fe87742 to
2be59a6
Compare
…ound for CI runner saturation Refs thunder-id#4268
2be59a6 to
d063e28
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/pr-builder.yml:
- Line 35: Update the job conditions for security-audit, dependency-review,
verify-mocks, and lint in .github/workflows/pr-builder.yml at lines 35-35,
56-56, 100-100, and 136-136 to allow workflow_dispatch runs unconditionally by
adding the github.event_name == 'workflow_dispatch' branch alongside the
existing pull-request and merge-group conditions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3d522020-56cc-40f6-a767-8f1d6e0d5217
📒 Files selected for processing (1)
.github/workflows/pr-builder.yml
Purpose
Every push to a PR currently runs the full PR Builder (~15 jobs), but during early review iteration devs are mostly addressing CodeRabbit/Copilot comments, so those runs are wasted and they saturate the shared runner pool for everyone. This gates the PR Builder on a
trigger-pr-builderlabel: devs iterate freely without consuming runners, then add the label when the PR is ready, which runs CI for that push and every subsequent one.Part of the queue-pressure work in #4268.
Approach
Built directly on
mainas a single commit, independent of #4269.labeledis added to thepull_requesttrigger types, and each root job's condition requires thetrigger-pr-builderlabel onpull_requestevents.merge_groupandworkflow_dispatchbehavior is unchanged, so the merge queue still fully validates every PR regardless of labels. Downstream jobs cascade off theirneedsand skip automatically on unlabeled runs; the twoalways()jobs and the detect-* jobs get the same label check so unlabeled pushes consume zero runners. (The build/test jobs are gated directly rather than relying ondetect-code-changesskipping, because their existing condition treats a skipped detect job as a green light.)The label is sticky: once added, later pushes run CI normally. Unlabeled runs report their jobs as skipped, and the
codecov/patchstatus stays at "Expected" until CI actually runs, so an unlabeled PR cannot enter the merge queue with skipped checks.Known limitation, deferred on purpose: adding any label to an already-labeled PR re-triggers the workflow, which restarts CI (and cancels an in-flight run via the concurrency group). Refinements for that (no-op concurrency group for unrelated label events) were prototyped and can be added later if it becomes annoying in practice.
The
trigger-pr-builderlabel has been created in the repo.Related Issues
Related PRs
Checklist
breaking changelabel added.Security checks
Summary by CodeRabbit
trigger-pr-builderlabel is present.