Age Validator
Validate PR age (time since creation or update)
The Age Validator checks the age of a pull request - how much time has passed since it was created or last updated. This helps identify stale PRs that need attention and enforce timely reviews and updates.
Configuration
Must be set to "age"
Constraints for the time since PR creation
Minimum age in days since creation
Maximum age in days since creation
Custom message for created age constraint failures
Constraints for the time since PR was last updated
Minimum age in days since last update
Maximum age in days since last update
Custom message for updated age constraint failures
Basic Usage
Examples
Identify Stale PRs
Detect PRs that haven’t been updated in a while:
Enforce Update Cooldown
Ensure PRs have had time to be reviewed before merging:
Expiry Policy
Implement an expiry policy for old PRs:
Combined Age Constraints
Apply multiple age-related constraints:
How It Works
Get Timestamps
The validator retrieves the PR’s created and updated timestamps
Calculate Ages
It calculates the age in days since creation and last update
Check Created Age
If created
constraints are specified, it checks if the age since creation is within limits
Check Updated Age
If updated
constraints are specified, it checks if the age since last update is within limits
Return Result
Returns a validation result with status (pass, fail, or error) and a message
Practical Use Cases
Stale PR Detection
Automatically label and notify about stale PRs:
PR Lifecycle Management
Implement a complete PR lifecycle management system:
Code Review Aging
Track how long PRs have been waiting for review:
Best Practices
Be mindful of vacation periods and other factors that might legitimately delay PR updates
Benefits of Age Validation
- Reduced Staleness: Prevents PRs from languishing without attention
- Faster Cycle Time: Encourages timely reviews and updates
- Better Communication: Prompts discussions about delayed PRs
- Cleaner PR Queue: Helps identify PRs that should be closed
- Workflow Visibility: Makes PR aging explicit and trackable