Repository navigation
ci: move branch naming check from Mergify to GitHub Actions - #1131
Conversation
Mergify's pull_request_rules creates a post_check on fork PRs with bad branch names even when head-repo-full-name guards should exclude them. This produces noisy failing checks on external contributions. Replace with a GitHub Actions job that uses a proper `if` gate to skip fork PRs entirely, and auto-closes internal PRs with bad branch names. Signed-off-by: Chang Su <chang.s.su@oracle.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughBranch naming convention enforcement is migrated from Mergify to GitHub Actions. The Mergify rule that validated branch names and closed non-conforming PRs is removed, replaced by a new Actions workflow job that validates branch names, comments with remediation guidance, and auto-closes failing PRs. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbc43dcc78
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| name: Branch Naming Convention | ||
| runs-on: ubuntu-latest | ||
| # Only enforce on internal PRs, not forks | ||
| if: github.event.pull_request.head.repo.full_name == 'lightseekorg/smg' && github.head_ref != 'main' |
There was a problem hiding this comment.
Prevent fork PR check noise at workflow trigger level
Using a job-level if here does not make the check invisible on fork PRs: the workflow still runs on every pull_request, and branch-naming becomes a skipped check run rather than disappearing. GitHub documents that skipped jobs are reported as successful status checks, so this still adds check noise on forks and does not achieve the stated “no skipped check” behavior.
Useful? React with 👍 / 👎.
Description
Problem
Mergify's
pull_request_rulescreates apost_checkstatus check on fork PRs even when thehead-repo-full-name = lightseekorg/smgcondition should exclude them. This produces noisy failing checks ("Rule: Enforce branch naming convention (internal) (post_check)") on external contributions.Verified across 20 fork PRs — 3 had the spurious check (#1115, #1088, #1082), all with branch names that don't contain a
/. Thedetails_urlon these checks points to the fork PR itself, confirming Mergify is directly evaluating the rule on forks (not SHA collision from another PR).The
head-repo-full-namecondition correctly prevents the actions (close/comment) from firing on forks, but does not prevent thepost_checkfrom being created. This is Mergify's internal behavior and cannot be configured.Additionally, the previously working
merge_protectionsblock (which usedifguards to properly gate check creation) was removed by auto-generated PR #906 — Mergify's bot keeps opening PRs to "upgrade" the config and removemerge_protections, making it unsustainable to maintain.Solution
pull_request_rulesentry from Mergify (eliminatespost_checknoise entirely)branch-namingjob to the existingpr-naming-check.ymlGitHub Actions workflowif: github.event.pull_request.head.repo.full_name == 'lightseekorg/smg'— completely invisible to fork PRs (no skipped check, no noise)Changes
.github/mergify.yml— removedEnforce branch naming convention (internal)rule and stale auto-generated comment.github/workflows/pr-naming-check.yml— addedbranch-namingjob with validation, comment, and auto-closeTest Plan
feat/something):branch-namingjob should passsomething): job should fail, post comment, and auto-close the PRbranch-namingjob should not appear at all in checks — no "Skipped", no noisepr-validationjob (PR title + commit message checks) still works unchangedTo test, push a branch with a bad name from the internal repo:
Checklist
cargo +nightly fmtpasses (no Rust changes)cargo clippy --all-targets --all-features -- -D warningspasses (no Rust changes)Summary by CodeRabbit