feat: add auto-rebase workflow for non-Dependabot PRs#158
Conversation
Extends the dependabot-rebase pattern to cover all non-Dependabot PRs. On every push to main, finds open same-repo PRs that are behind the base branch and updates them via the GitHub update-branch API. Handles two failure modes gracefully: - workflow-permission 403: posts an idempotent comment asking the author to rebase manually (sentinel: <!-- auto-rebase-blocked -->) - merge conflict 422: posts an idempotent comment asking the author to resolve conflicts (sentinel: <!-- auto-rebase-conflict -->) Skips Dependabot PRs (handled by dependabot-rebase.yml) and fork PRs.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 35 minutes and 35 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ 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 |
- Add explicit .head.repo != null guard in jq filter (deleted forks return null for .head.repo; explicit check is clearer than relying on null comparison being false) - Drop HTTP status extraction via grep: gh api does not output 'HTTP NNN' in that format; the variable was unused in fix logic - Fix merge conflict detection: was 'HTTP 422|merge conflict' but 'HTTP 422' never appears in gh api error output; use grep -qi 'merge conflict' to match GitHub's JSON error message - Use gh pr view --json comments for sentinel checks, matching the dependabot-rebase-reusable.yml pattern
- Add auto-rebase.yml to Available Templates table in ci-standards.md - Add section 8 documenting auto-rebase behaviour, failure modes, and compliance expectations; renumber Feature Ideation to section 9 - Add auto-rebase.yml:auto-rebase-reusable to check_centralized_workflow_stubs so repos adopting the workflow are verified as thin caller stubs
- Update Feature Ideation anchor fragment to #9 after section renumber - Add blank line before ordered list (MD032)
Multi-line --body strings that start continuation lines at column 1 terminate the YAML literal block scalar, causing yamllint to flag the leading ** as a syntax error. Replace both gh pr comment multi-line bodies with variable concatenation using $'\n' escapes.
|


Summary
.github/workflows/auto-rebase-reusable.yml— new org-level reusable that updates non-Dependabot PRs behind the base branch on every push tomain.github/workflows/auto-rebase.yml— thin caller for this repo (adopts immediately)standards/workflows/auto-rebase.yml— template for other repos to adoptWhy separate from
claude.ymlRebasing is a mechanical git operation — it doesn't need an LLM on the happy path. Running Claude just to call
update-branchwastes credits and conflates AI review with branch hygiene. Thedependabot-rebaseworkflow already establishes this pattern; this PR extends it to all PRs.Behaviour
On
pushtomain:head.repo == base.repo(no fork PRs)behind_by > 0, callsPUT /pulls/{n}/update-branchwithmergemethodworkflowspermission error → posts a one-time comment with manual rebase instructionsTest plan
main; verify the workflow runs and updates a behind PR