Skip to content

Add GitHub workflow to enforce PR target branch policy#314

Merged
tomquist merged 1 commit into
developfrom
claude/keen-planck-5ssLC
Jun 4, 2026
Merged

Add GitHub workflow to enforce PR target branch policy#314
tomquist merged 1 commit into
developfrom
claude/keen-planck-5ssLC

Conversation

@tomquist
Copy link
Copy Markdown
Owner

@tomquist tomquist commented Jun 4, 2026

Summary

This PR adds a new GitHub Actions workflow that automatically enforces a branch targeting policy, requiring contributors to target the develop branch instead of main for pull requests.

Key Changes

  • Added .github/workflows/enforce-pr-target.yml workflow that:
    • Triggers on pull request events (opened, reopened, edited, synchronize) targeting main
    • Automatically requests changes on PRs from non-maintainers that target main
    • Provides clear instructions for contributors on how to retarget their PR to develop
    • Includes guidance on rebasing branches if needed
    • Prevents duplicate bot reviews using a marker comment
    • Allows maintainers (owners, members, collaborators) to bypass the check for release PRs and other special cases
    • Uses concurrency controls to serialize checks per PR and prevent race conditions

Implementation Details

  • The workflow uses pull_request_target to safely access PR context with write permissions
  • Deduplication logic checks for existing "CHANGES_REQUESTED" reviews from the bot before creating a new one
  • The check fails the workflow but does not close the PR, allowing it to be fixed and automatically cleared
  • Includes helpful bash commands for contributors to rebase their branches onto develop

https://claude.ai/code/session_01PwHHfg6c1QV7o1pzWgd7gw

PRs should target the develop branch. When a PR from outside the team
targets main, this workflow requests changes with an explanatory comment
and fails the check, without closing the PR. Owners, members and
collaborators are exempt so maintainers can target main directly
(e.g. release PRs).

The comment also explains how to rebase onto develop so branches created
from main don't carry unrelated commits into the PR.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Warning

Review limit reached

@tomquist, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 1 minute and 5 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 00949ff6-66ec-47aa-857c-9a9da37d9013

📥 Commits

Reviewing files that changed from the base of the PR and between be29bd8 and de970d1.

📒 Files selected for processing (1)
  • .github/workflows/enforce-pr-target.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/keen-planck-5ssLC

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.

@tomquist tomquist marked this pull request as ready for review June 4, 2026 16:55
@tomquist tomquist merged commit b00837c into develop Jun 4, 2026
13 checks passed
@tomquist tomquist deleted the claude/keen-planck-5ssLC branch June 4, 2026 17:02
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.

2 participants