DevSensei | Code Owners for Bitbucket

Top-Level Properties

  • 🔰 fundamental topics for beginners getting started with DevSensei

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

A devsensei.yaml file has a few reserved top-level properties:

Attribute

Definition

workflows

The list of workflow definitions. See Workflows

includes

Include configuration from another file. See Share Configuration with Includes

shared

Reuse configuration in the same file. See Share Configuration with YAML anchors

run-schedule

Some conditions depend on the age of the pull request. See Configuration of time sensitive conditions

Share Configuration with Includes 🔬

With includes, common Devsensei workflows can be shared both across repositories as well within projects in a monorepo.

To include a devsensei.yaml file from another repository, use this syntax:

YAML
includes:
- repository: shared-configs
  file: project-devsensei.yaml

Only repositories of the same Bitbucket project are supported.

The Bitbucket users require READ access to the repository with the shared configuration. Otherwise users will get permission issues, because they cannot access the required configuration.

When a plain YAML file path is specified, the included file is read from the same repository:

YAML
includes:
- common/devsensei.yaml
  • The files are read from the latest commit of the default branch

  • Only one level of includes are support (no recursion supported)

Sharing Parts of the Configuration with YAML Anchors 🔬

Use YAML Anchors to define reusable content in the same YAML file.

Example showing how to share conditions across workflows:

YAML
shared:
  conditions:
    - &non-hotfix-to-release-branch
      - source~!=hotfix/*
      - destination~=release/*

workflows:
  - name: comment
    conditions: *non-hotfix-to-release-branch
    actions:
      - add-comment:
          content: |
            Hotfix branch expected as source branch when merging into release branches.
            Source was ${source}.
  - name: codeowners
    custom-attributes:
      codeowners:
        rules: |
          *.js  @peter
    conditions: *non-hotfix-to-release-branch
    actions:
      - add-reviewers:
          members: codeowners
  • Anchors can be used for any content. For example, to define reusable custom user groups, or conditions.

  • Reference must reference anchors in the same file. It is not possible to define an anchor in one file, and reference it from another file.

  • Anchor names cannot contain the [, ], {, }, and , characters.

  • Anchors can be defined anywhere in the file, although we encourage to use the shared section at the top of the file for clarity and easier maintenance.

Configuration of the condition checks for time-dependent attributes 🔬

Workflow conditions involving time-dependent attributes (such as the age of the Pull Request) are re-evaluated every hour (in addition to any other change in the pull request). This behavior can be changed by specifying the schedule at the root of the devsensei.yaml file, under the run-schedule property.

Example:

YAML
run-schedule:
  every: 30 minutes