DevSensei | Code Owners for Bitbucket

Conditions

  • 🔰 fundamental topics for beginners getting started with DevSensei

  • 🔬 advanced topics for once you have your first workflows automated

The conditions property of a workflow is configured with a list of conditions.

Conditions are a list of boolean expressions, that must be true simultaneously for a workflow to be considered active.

Example

YAML
workflows:
  - name: draft checks
    conditions:
      - or:
          - draft
          - title ~= '[DRAFT]*'
      - destination ~!= 'release/*'

Condition evaluation

Each condition is a boolean expression, so composition with and and or obeys the usual rules for boolean algebra.

If there are no conditions (i.e. there is no mapping, or an empty list), then the condition is always met by default, so any action in the workflow run at least once. This means that each additional condition further constrains the cases where actions should be applied. If there are more than one condition in a workflow’s conditions property, then they must be all true simultaneously for the overall condition to be met (i.e. they are combined with and implicitly).

Conditions are dynamic expressions, and can retrieve and compare metadata (known as attributes) associated with the current pull request. Conditions are evaluated when a pull request is created, whenever the pull request or its various metadata changes.

Syntax 🔬

Condition Kind

YAML syntax

Meaning

AND combinator

and: [...]

combine a list of conditions with AND (all must be fulfilled)

OR combinator

or: [...]

combine a list of conditions with OR (at least one must be fulfilled)

simple expression

- "..."

text which is interpreted as an expression