Validations
Validate pull request content and metadata
Validations check if a pull request meets specified criteria. The validate
property of a rule contains an array of validations to run. All validations must pass for the rule to be considered successful.
Validation Structure
Validations are defined in the validate
array of a rule:
Each validation has a type
and type-specific parameters.
Available Validator Types
Title
Validate PR title format and length
Commit
Validate commit message format
Description
Validate PR description content and length
Branch
Validate branch naming conventions
Size
Validate PR size (files, additions, deletions)
Dependent
Validate related files are included
Task List
Validate task list completion in PR description
Approvals
Validate PR approval requirements
Label
Validate PR labels
Age
Validate PR age (time since creation/update)
Common Parameters
While each validator has specific parameters, some common parameters include:
Custom message to show when validation fails
Pattern(s) that content should match (supports regex)
Pattern(s) that content should not match (supports regex)
Example Use Cases
Title Validation
Ensure PR titles follow a convention:
Size Limitations
Keep PRs manageable in size:
Required Approvals
Ensure PRs get adequate review:
Complete Description
Require comprehensive PR descriptions:
Validation Results
Each validation produces a result with:
- Status: One of
pass
,fail
, orerror
- Validator: The validator type
- Message: A description of the result
- Details: (Optional) Additional information
These results determine whether to run on_success
or on_failure
actions.
Templates
You can use the {{ validation_summary }}
template variable in your action messages to include a summary of all validation results:
Advanced Example
This comprehensive example validates multiple aspects of a PR including title format, description length, PR size, required labels, and task list completion.