DevSensei | Code Owners for Bitbucket

DevSensei: PR Workflow Automation

  • 🔰 fundamental topics for beginners getting started with DevSensei

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

DevSensei is a pull request workflow automation solution.

It is for teams who want to:

  • reduce the overhead of working with pull requests.

    • e.g. auto merge minor changes after the automated checks passed

  • automate workflows in pull requests.

    • e.g. assign the right reviewers

  • follow and enforce team policies.

    • e.g. add tasks to the pull request based on what changes are made, and block merging until the tasks are completed.

Getting Started 🔰

  1. After installing the DevSensei app, it should be enabled by default in your repository:

    1. Navigate to the repository → Repository Setting (⚙️ on the left) → DevSensei. Alternatively, the setting is also available at the project level.

    2. In the settings panel, the app toggle should be ✅ (enabled).

  2. Add the sample devsensei.yaml file below to the root folder of your repository, on the default branch.

Workflow to add comment on pull requests ready to review (basic example)

YAML
workflows:
- name: Add Comment
  conditions:
    - not(draft)
  actions:
    - add-comment:
        content: |
          This pull request is ready to review.
          Thanks.
  1. Done! When you create a pull request, then the comment will be added. On draft pull requests the comment is added as soon as the pull request is marked as ready to review.

Some more examples

You can learn more about what are workflows in the next overview, but first here is a sample of the possibilities:

YAML
workflows:
- name: Bugfix Release Policy Reminder
  conditions:
    - destination ~= 'release/*' # When the pull request targets a release branch
    - source ~!= 'bugfix/*'    # And isn't from a bugfix branch
  actions:
    # Add the reminder comment
    - add-comment:
        content: |
          Reminder: Only bugfixes should be merged into a release branch.
          If it is not an urgent bugfix, please change the
          pull request destination to the development branch.
- name: Release Tasks
  conditions:
    - source=main
    - destination=latest-release
  actions:
  - add-comment:
      content: Is the public documentation up to date?
      task: true
  - add-comment:
      content: The release announcement is prepared?
      task: true
- name: Add reviewers
  custom-attributes:
    codeowners:
      rules: |
        **/*.java    java-expert@our-company.com
        **/*.js      javascript-expert@our-company.com
  conditions:
    - destination ~!= 'sandbox/*'
  actions:
    - add-reviewers:
        members: codeowners