Skip to content

feat: add auto-rebase workflow for non-Dependabot PRs#158

Merged
don-petry merged 6 commits intomainfrom
feat/auto-rebase-all-prs
Apr 21, 2026
Merged

feat: add auto-rebase workflow for non-Dependabot PRs#158
don-petry merged 6 commits intomainfrom
feat/auto-rebase-all-prs

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

Summary

  • Adds .github/workflows/auto-rebase-reusable.yml — new org-level reusable that updates non-Dependabot PRs behind the base branch on every push to main
  • Adds .github/workflows/auto-rebase.yml — thin caller for this repo (adopts immediately)
  • Adds standards/workflows/auto-rebase.yml — template for other repos to adopt

Why separate from claude.yml

Rebasing is a mechanical git operation — it doesn't need an LLM on the happy path. Running Claude just to call update-branch wastes credits and conflates AI review with branch hygiene. The dependabot-rebase workflow already establishes this pattern; this PR extends it to all PRs.

Behaviour

On push to main:

  1. Lists all open non-Dependabot PRs with head.repo == base.repo (no fork PRs)
  2. For each one behind_by > 0, calls PUT /pulls/{n}/update-branch with merge method
  3. On workflows permission error → posts a one-time comment with manual rebase instructions
  4. On merge-conflict 422 → posts a one-time comment asking the author to resolve conflicts
  5. Idempotent: skips PRs that already have the sentinel comment to avoid spam

Test plan

  • Push a commit to main; verify the workflow runs and updates a behind PR
  • Verify Dependabot PRs are skipped
  • Verify fork PRs are skipped
  • Force a conflict and verify the comment is posted exactly once

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 35 minutes and 35 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: fc532b26-030b-433c-ad04-b92c18e015ad

📥 Commits

Reviewing files that changed from the base of the PR and between 3a467f4 and 0fe7352.

📒 Files selected for processing (5)
  • .github/workflows/auto-rebase-reusable.yml
  • .github/workflows/auto-rebase.yml
  • scripts/compliance-audit.sh
  • standards/ci-standards.md
  • standards/workflows/auto-rebase.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-rebase-all-prs

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- 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.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant