Skip MR coach assignment for docs-only community MRs when a TW is available

What does this MR do and why?

Improves the @gitlab-bot ready command so it does not assign an MR coach when a community MR is docs-only and a technical writer can be identified automatically via CODEOWNERS.

Problem

When a contributor runs @gitlab-bot ready on a docs-only MR, two reviewers were being assigned:

  1. A random MR coach (via CommandMrRequestReview)
  2. A technical writer (via AutomatedReviewRequestDoc, triggered by the workflow::ready for review label)

This caused unnecessary pings and confusion. Real-world example: gitlab-org/gitlab-runner!7146 (merged) where @gitlab-bot ready assigned both @sabadi1 (coach) and @ashrafkhamis (TW).

Solution

In CommandMrRequestReview, before falling back to the random-coach path:

  1. Docs-only detection: uses the existing Triage::ChangedFileList#only_change? method with %r{\Adocs?/} to check whether every changed file is under docs/ or doc/.
  2. TW availability check: calls Triage::DocumentationCodeOwner#most_specific_approvers to confirm a TW would actually be assigned.
  3. Skip coach and skip comment: if both conditions are true, no human-facing comment is posted (the AutomatedReviewRequestDoc processor already posts its own comment when it assigns the TW). Only quick actions are posted: /unlabel ~"automation:author-reminded", /ready, and /label ~"workflow::ready for review", so AutomatedReviewRequestDoc runs and assigns the TW.
  4. Fallback safety: if the MR is docs-only but no TW approver is found, the coach is still assigned so the MR is never left without a reviewer.
  5. Explicit reviewers / current reviewers: unaffected — the skip only applies to the random-coach path.

Action items

Closes #1050 (closed) Related to #1701

Edited by Ben Bodenmiller

Merge request reports

Loading
Loading