chore(ci): make Guard main branch re-evaluate on base changes - #27776
chore(ci): make Guard main branch re-evaluate on base changes#27776mateo-berri wants to merge 2 commits into
Conversation
When a PR is opened against main and then retargeted to another branch (e.g. litellm_internal_staging), the guard's earlier failed run lingers on the PR even though the rule no longer applies. The `branches: [main]` filter means the workflow does not refire after the base change, so the stale red status sticks. Listen on all pull-request events (including `edited`, which fires on base changes) and short-circuit inside the job when `base_ref != main`. Main-targeted PRs still get the existing head-repo and branch-name checks; non-main PRs exit cleanly in a few seconds, so a base flip away from main produces a fresh passing run that supersedes the failing one.
Greptile SummaryThis CI-only change fixes a stale failed-check problem: when a PR was opened against
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to the CI trigger and an early-exit guard; main-targeted PRs go through the same fork and branch-name checks as before. The diff is minimal: one trigger-filter swap and a four-line shell guard. The job name is preserved, so branch protection on No files require special attention.
|
| Filename | Overview |
|---|---|
| .github/workflows/guard-main-branch.yml | Removes branches: [main] trigger filter, adds edited event type, and inserts a BASE_REF != main early-exit guard so the workflow re-runs cleanly when a PR is retargeted away from main. |
Reviews (1): Last reviewed commit: "style: remove unneeded comments" | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
🚅 Hi, thanks for the PR! I'm Agent Shin, the automated triage bot for this repository. What's this and why am I getting it? I read the description against our contribution rubric. Here's how it lined up: What you got right:
What's still missing:
If the description isn't updated in the next 24 hours, I'll auto-close this PR. That's not us saying we don't care about the change; we want the open-PR list to mirror what a maintainer can act on right now, so contributors don't get lost in a backlog. A closed PR is a soft "park this for later," not a rejection. Take your time; everything below still works after the close. During the grace period: just update the PR description with the missing pieces. No need to ping me; I'll re-check on the next sweep and skip the auto-close if it now passes. See what counts as QA proof for the full rubric (a linked issue alone isn't enough; it covers context, not proof). If the PR does get auto-closed in 24 hours, you still have easy recovery paths:
Internal BerriAI contributors: this rubric doesn't apply to you; ping a maintainer. (I'm an LLM, so I'm not infallible. If you think I got this wrong, ping a maintainer; they'll override me.) |
Summary
Guard main branch(.github/workflows/guard-main-branch.yml) currently usespull_request.branches: [main]to gate execution. That filter only matches when the PR's current base ismain. When a PR is opened againstmainand later retargeted (e.g. tolitellm_internal_staging), the workflow does not refire, so the earlier failed run sticks on the PR even though the branch-name rule no longer applies. This bit #27775, where the PR was briefly opened againstmainbefore flipping tolitellm_internal_staging.Fix
Drop the
branches: [main]filter, addeditedtotypesso base changes retrigger the workflow, and short-circuit inside the job whengithub.base_ref != main. Main-targeted PRs still get the existing head-repo and branch-name checks unchanged; non-main PRs exit cleanly in a few seconds, and a base flip away frommainproduces a fresh passing run that supersedes the old failing status on the PR.Job name (
Verify PR source branch) is preserved, so the existing branch-protection requirement onmainkeeps working.Files touched
.github/workflows/guard-main-branch.yml— adjust trigger to listen on all PR events (opened, synchronize, reopened, edited), addBASE_REFto env, exit 0 early when base != main.Test plan
litellm_internal_stagingshould pass (base != mainshort-circuit). If we ever rebase another PR ontomainand back, the run history on the PR should end on a green statusType
🛠️ CI / Infra
Note
Low Risk
Low risk: only adjusts a GitHub Actions workflow trigger and adds an early-exit for non-
mainPR bases, without changing application/runtime code paths.Overview
Updates the
Guard main branchGitHub Actions workflow to re-evaluate when a PR’s base branch changes by listening to additionalpull_requestevent types (includingedited) instead of filtering onbranches: [main].Adds a
github.base_refcheck inside the job to skip the guard (exit 0) when the PR is not targetingmain, while keeping the existing fork and source-branch restrictions for PRs that do targetmain.Reviewed by Cursor Bugbot for commit 8358c9a. Bugbot is set up for automated code reviews on this repo. Configure here.