Condition Engine
The Pull Checklist condition engine allows you to create sophisticated rules for when checklists and individual checks should appear. This powerful feature helps you create dynamic checklists that respond to your pull request's characteristics.
Repository Level Rules
These rules are applied at the repository level and can be used to create conditions based on files, branches, and PR characteristics.
Rule | Description | Example |
---|---|---|
file_present?("absolute_file_path") | Checks if a specific file exists in the repository | file_present?("package.json") |
file_content_present?("absolute_file_path", "content") | Checks if specific content exists in a file | file_content_present?("README.md", "Installation") |
file_content_present?("absolute_file_path", "[regex]") | Checks if content matching a regex pattern exists in a file | file_content_present?("config.js", "[a-z])\w+") |
directory_present?("absolute_file_path") | Checks if a specific directory exists | directory_present?("src/components") |
pattern_present?("[regex]") | Checks if any file content matches the regex pattern | pattern_present?("[a-z])\w+") |
file_pattern_present?("[regex]") | Checks if any file name matches the regex pattern | file_pattern_present?("^.*\.(svelte)$") |
base_branch?("[regex]") | Checks if the base branch matches the pattern | base_branch?("^.*\.(main)$") |
feature_branch?("pattern") | Checks if the feature branch matches the pattern | feature_branch?("please-merge-very-fast-*") |
title_contains?("text") | Checks if the PR title contains specific text | title_contains?("reverts") |
description_contains?("text") | Checks if the PR description contains specific text | description_contains?("new feature") |
description_is_empty? | Checks if the PR description is empty | description_is_empty? |
pr_is_draft?(boolean) | Checks if the PR is in draft status | pr_is_draft?(true) |
pr_additions_greater_than?(number) | Checks if the PR has more additions than specified | pr_additions_greater_than?(300) |
pr_deletions_greater_than?(number) | Checks if the PR has more deletions than specified | pr_deletions_greater_than?(200) |
label_match?("label") | Checks if the PR has a specific label | label_match?("an-important-label") |
applied_to_users?(["username1", "username2"]) | Checks if the PR owner is in the specified list of users | applied_to_users?(["username1", "username2"]) |
has_requested_reviewer?("username") | Checks if a specific GitHub user is requested as a reviewer | has_requested_reviewer?("senior-dev") |
has_requested_team?("team-slug") | Checks if a specific GitHub team is requested as a reviewer | has_requested_team?("frontend-team") |
Global Rules
These rules are applied globally across all repositories and can be used to create organization-wide conditions.
Rule | Description | Example |
---|---|---|
repo_rule_status_label_match?(boolean) | Matches the checklist title with repository rules | repo_rule_status_label_match?(true) |
label_match?("label") | Checks if the PR has a specific label (global context) | label_match?("an-important-label") |
title_contains?("text") | Checks if the PR title contains specific text (global context) | title_contains?("reverts") |
description_contains?("text") | Checks if the PR description contains specific text (global context) | description_contains?("new feature") |
description_is_empty? | Checks if the PR description is empty (global context) | description_is_empty? |
pr_is_draft?(boolean) | Checks if the PR is in draft status (global context) | pr_is_draft?(true) |
pr_additions_greater_than?(number) | Checks if the PR has more additions than specified (global context) | pr_additions_greater_than?(300) |
pr_deletions_greater_than?(number) | Checks if the PR has more deletions than specified (global context) | pr_deletions_greater_than?(200) |
file_pattern_present?("[regex]") | Checks if any file name matches the regex pattern (global context) | file_pattern_present?("^.*\.(svelte)$") |
base_branch?("[regex]") | Checks if the base branch matches the pattern (global context) | base_branch?("^.*\.(main)$") |
feature_branch?("pattern") | Checks if the feature branch matches the pattern (global context) | feature_branch?("please-merge-very-fast-*") |
checklist_applies_to_repository?(["repo1", "repo2"]) | Checks if the current repository matches any in the provided list | checklist_applies_to_repository?(["web-app", "mobile-client"]) |
has_requested_reviewer?("username") | Checks if a specific GitHub user is requested as a reviewer (global context) | has_requested_reviewer?("senior-dev") |
has_requested_team?("team-slug") | Checks if a specific GitHub team is requested as a reviewer (global context) | has_requested_team?("frontend-team") |
Using Conditions
You can combine multiple conditions using logical operators (||
, &&
, !
, ()
). Here are some examples:
// Show checklist only for large PRs with specific label
pr_additions_greater_than?(300) && label_match?("needs-review")
// Show checklist for draft PRs or PRs with specific content
pr_is_draft?(true) || file_content_present?("README.md", "Installation")
// Show checklist for feature branches targeting main
base_branch?("^.*\\.(main)$") && feature_branch?("please-merge-very-fast-*")
// Apply checklist only to specific repositories and large PRs
checklist_applies_to_repository?(["web-app", "mobile-client"]) && pr_additions_greater_than?(300)
// Show checklist only when both specific reviewer and team are requested
has_requested_reviewer?("senior-dev") && has_requested_team?("frontend-team")
// Show checklist for specific users' PRs
applied_to_users?(["username1", "username2"]) && !description_is_empty?
Custom Rules
Need a specific rule for your use case? We're happy to help! Reach out to us via the chat widget, and we'll work with you to implement custom rules that match your workflow requirements.
Best Practices
When using the condition engine:
- Start with simple conditions and add complexity as needed
- Test your conditions thoroughly before enforcing them
- Use meaningful labels and consistent patterns
- Document your conditions for team reference
- Consider the impact on your workflow
Next Steps
Learn more about: