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.
- Create a project
- In rails console enable the feature flag
Feature.enable(:approval_policy_disable_bot_comment, Project.last)
- 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
- Configure with a merge request & merge
- Go back to the project and create MR (for example, update
README.md
) - Verify that no bot comment has been created, although the approvals for the policy are required
- Go back to the policy and change the action to
enabled: true
- Verify that a bot comment has been created
- Go back to the policy and remove the second action (
type: send_bot_message
) altogether - Create a new MR and verify that bot comment is created.
Related to #438269 (closed)