What are rules?
A rulle is a collection of conditions that determine how points are added to or subtracted from a pull request’s score. Each rule can contain one or more conditions, and PullRule supports multiple rules within your organisation. These rules evaluate pull requests as they come in or are updated.Rules are executed on every new pull request and whenever a pull request is modified in the repository.
Autonomy of a condition
Each condition in a rule follows an “if this, then that” strucute. Example:IfThis allows you to design scoring strategies that reward or penalise PRs based on specific traits or conventions.number of changed filesis greather than 50, thensubtract 5 pointsfrom the pull request score.
Available conditions
Each condition evaluates a specific attribute of the pull request. Here are the supported conditions and their operators:
Each condition must specify an outcome:
- Add points (reward good practices)
- Subtract points (penalise undesirable patterns)
Building rules
You can add as many conditions as you want to a single rule or create multiple rules to capture different scoring strategies (e.g. size control, commit hygiene, title formant enforcement, etc.). Rules are evaluated independently, and their outcomes are cumulative. This means that if multiple rules apply to a pull request, the points from each rule are summed to produce the final score.Selecting when rules are applied
You may choose to apply rules each time a pull request is created or updated, or as an example only when a pull request is merged. This flexibility allows you to control when the rules are enforced and how they impact the pull request workflow. In the rule settings, you can select the appropriate “stage” for the rule to apply. These stages include:- Every change: The rule is evaluated on every new pull request and whenever a pull request is modified.
- On initial index: The rule is evaluated only when a pull request is created.
- On manual trigger: The rule is evaluated only when you manually trigger it through the API.
- On merge: The rule is evaluated only when a pull request is merged.

