Enforce manageable PR sizes with automatic labeling and feedback
This example shows how to enforce size limits on pull requests and provide helpful feedback to contributors, encouraging smaller, more focused changes.
ruleset: # Rule 2: PR Size Limits - name: "PR Size Check" when: - "pull_request.opened" - "pull_request.synchronize" validate: - type: "size" files: 10 total: 500 addition: 400 deletion: 200 message: "This PR is too large. Please split it into smaller PRs." on_failure: - label: add: ["large-pr"] - comment: body: | ## Large Pull Request Detected This PR exceeds our size guidelines: {{ validation_summary }} Large PRs are harder to review and more likely to introduce bugs. Please consider: - Breaking this change into multiple smaller PRs - Focusing each PR on a single concern - Removing unnecessary changes or generated files If this large PR is absolutely necessary, please provide a detailed explanation.
on_failure: - comment: body: | ## Large Pull Request Detected This PR exceeds our size guidelines. Here are some strategies to make it more manageable: 1. **Split by feature**: Create separate PRs for each logical feature or change 2. **Split by layer**: Separate backend/frontend/UI changes into different PRs 3. **Split by directory**: Create PRs based on directories or components 4. **Split by steps**: Submit refactoring before adding new features Remember that smaller PRs: - Get reviewed faster - Are more likely to be approved - Have fewer bugs - Provide quicker feedback If splitting isn't possible, please explain why in the PR description.