The core building block across PullApprove are “expressions”. Expressions allow you to write custom, low-code rules for your code review workflows, reports, and more.

Expressions are evaluated in a secure, isolated Python environment, using a set of provided functions and variables. You can use human-readable operators like in, not in, and, and, or (in addition to ==, !=, >, etc.).

In addition to a set of “utility” functions and objects, the expressions environment includes a lightweight abstraction of data available via the GitHub API. This allows you to write custom rules that are easy to read and understand, without having to worry about the implementation details of the GitHub API.

For example, this expression matches PRs where was modified:

"" in pull.files

All of the available functions and objects are available in the UI as you type. Some of the variables change depending what the expression is being applied to.


In notifications and reports, you can use expressions to customize the content of the message.

These templates are rendered using Jinja, and have similar variables and functions available as expressions.

To output a variable, you use the Jinja {{ variable }} syntax. See the Jinja documentation for more details.


What about Python’s list comprehension syntax?

Unfortunately, the Python list comprehension syntax is not supported in expressions. Instead you can use items.filter() and methods, among others.