Fetch protected staging branches via GraphQL instead of REST. - #55
Conversation
Avoids GitHub 504s on large repos where GET /branches?protected=true times out while evaluating protection across thousands of branches. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough
ChangesProtected branch lookup
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
Comment |
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 `@apps/github.js`:
- Around line 20-32: Update the GraphQL query used by the repository refs lookup
to request each Ref’s rules in addition to branchProtectionRule, then update the
branch filtering in the refs iteration to include refs with at least one
applicable rule. Preserve inclusion of classic branchProtectionRule-protected
refs while adding ruleset-protected branches.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: da28a3a9-b856-45de-ba50-ea589952723d
⛔ Files ignored due to path filters (1)
dist/index.jsis excluded by!**/dist/**
📒 Files selected for processing (1)
apps/github.js
branchProtectionRule only covers classic protection; Ref.rules also picks up active repository and organization rulesets. Co-authored-by: Cursor <cursoragent@cursor.com>
Avoids GitHub 504s on large repos where GET /branches?protected=true times out while evaluating protection across thousands of branches.
Updated
fetchProtectedBranchNamesto use paginated GitHub GraphQL queries. It now returns protectedstaging/branches covered by classic branch protection rules or active repository and organization rulesets. This avoids REST API 504 timeouts in large repositories.