Skip to content

Add send_bot_message action to policies

What does this MR do and why?

This MR adds a new merge request approval policy action that allows bot comment to be disabled for a given policy.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Create a project
  2. In rails console enable the feature flag
    Feature.enable(:approval_policy_disable_bot_comment, Project.last)
  3. In the project, create a new merge request approval policy:
    type: approval_policy
    name: Any MR without comment
    description: ''
    enabled: true
    rules:
      - type: any_merge_request
        branch_type: protected
        commits: any
    actions:
      - type: require_approval
        approvals_required: 1
        role_approvers:
          - developer
      - type: send_bot_message
        enabled: false
    approval_settings:
      prevent_approval_by_author: true
      prevent_approval_by_commit_author: true
      remove_approvals_with_new_commit: true
      require_password_to_approve: false
  4. Configure with a merge request & merge
  5. Go back to the project and create MR (for example, update README.md)
  6. Verify that no bot comment has been created, although the approvals for the policy are required
  7. Go back to the policy and change the action to enabled: true
  8. Verify that a bot comment has been created
  9. Go back to the policy and remove the second action (type: send_bot_message) altogether
  10. Create a new MR and verify that bot comment is created.

Related to #438269 (closed)

Merge request reports